Blynk causes Analog input to switch to Digital Output on Particle

Running a very simple program on Particle Photon - below.

Using an Analog input A0 to display a gauge on Blynk, the code runs great about 1/2 hour, then for no reason I can find the Analog input on the Particle goes low impedance (like a it was switched to a Digital output and sent low). This is verified with a DMM. So the analog readings are very low after this event. A reset of the Particle board usually fixes this for a few minutes, not always. Other programs on the Particle without Blynk work fine - Tinker for example

Using Blynk library 0.3.8, Particle Photon using 0.5.2

```// This #include statement was automatically added by the Particle IDE.
#include "blynk/blynk.h"

char auth[] = "771825b75e0c4177874595*******";

void setup()

void loop()

This problem occurred over the weekend 8/20/16 and 8/21/16. On monday 8/22 the problem went away, as if someone reset something or fixed something.

Blynk seems to be freezing the Analog input on my Electron. It used to work fine until 2 days ago.

When I connect photo resistor to any of the analog pin, it works well for a few seconds, then the value will change to between 240 and 260 and will remain there, even if i remove the photo resistor. If I change to another analog pin, it will work for a few seconds and the scenario repeats itself.

If I remove Blynk code and make use of only particle sketch to read the analog pin, it works fine. I even used a fresh Blynk code from the library without any modification, the issue persists.

Hi. Please try changing your code to use virtual pins, and tell us if it helps…

@vshymanskyy, I was running on firmware version 0.5.2. I just upgraded the device firmware to 0.6.0 and also updated the apps build firmware to 0.5.3 and the analog reading is now working fine.

I discovered that when I upgraded the build firmware to 0.6.0, the Blynk apps was showing “Your particle Electron not in network”, I had to downgrade to 0.5.3 for it to connect.Does this mean that Blynk doesn’t support Firmware Build version 0.6.0 yet?

We didn’t test with these builds yet.
Anyway if you switch to virtuals pins, the problem should vanish

@vshymanskyy, I used this code with the 0.5.2 build, but I was having the same issue, the same code is working fine with build 0.5.3:

    BLYNK_READ(V6) // Widget in the app READs Virtal Pin V6 with the certain frequency
      int analogPin = A0;             // light sensor connected to analog pin A0
      int val = 0;                    // variable to store the read value
      val = analogRead(analogPin);  // read the analogPin
      Blynk.virtualWrite(6, val ); //writes the value of A0 to V6

Is there any other way I could have used the Virtual Pin?

did you set pinMode for this pin?
do you have any widget that is also referring to A0, instead of V6 ?

@vshymanskyy, pinMode was not set for this pin.

Yes I had a widget also referring to A0. But when I thought this could be causing the issue, I removed my code and used only 01_Particle Library without any modification, I then only used A0 on the blynk apps without using any Virtual PIn, but the situation persisted.

  1. remove the widget referring to A0
  2. add pinMode(A0, INPUT) selection to your code with V6 usage (in setup function)

@vshymanskyy, the issue was resolved immediately i upgraded to Build firmware version 0.5.3, so I think it’s the 0.5.2 that was having the issue.

I’m having a widget using A0 and it is also mapped to V6 using code, and I used another widget to read V6, and didn’t declare A0 as input. Both A0 and V6 are showing same result on widget, and doesn’t give wrong value like before since I upgraded to 0.5.3