[SOLVED] APP - Label (display widget) sensor stop reading when assign a pin to a switch

Good evening, I have some troubles with the app of Blynk, I have 2 soil humidity sensor that are connected to the Analog input, with Blynk i can easily show the values in a graph and in a label! but when i try to assign a switch (for a rele) the first sensor that worked correctly until this moment (showing correct values like 250,260) now is showing 0… also the graph show 0, and if i invert the sensor pins, it remains the same (0), if i delete the label the second label of the second sensor goes to 0… and thats it! it is my fault or it is a bug problem of the app? maybe someone has the same problem.
Thank you in advance!
PS: when i delete the button the first sensor label it “turned on” showing the right value… until now, that it is showing 0 in any case, either if i delete the button

What hardware are you using ? Are you sending 2 different signals to 1 analog input ? Have you tried to turn it off and on again ?

Need more details… iOS or Android; App version, Blynk Library version; using Cloud Server or Local Server, etc. and show the code you are using. Thanks.

I am using Arduino Mega connected via Serial USB, the connection is ok, i have 2 sensor in 2 different analog input (A0 and A1)
I can select any digital pin for the “virtual button” on the app and it give me the same problem, the first sensor (label or graph) connected goes to 0 (if i delete the first sensor it goes to 0 the other remaining)
with a restart i solved the last problem that i wrote in PS ( so when i delete the button the label or graph starts to show correctly values )

I’m using (the latest) Android app 2.13.3

I’m connected to the cloud (i opened the file bash in /scripts )

and the code is the basic Blynkblink , is maybe this the problem ?
I’m totally new to blynk, but if i put the button the relè connected to the same pin in the arduino it works perfectly, is just the label that doesn’t work anymore…

OK, I think I understand a bit better… part of the confusion is that the term “label” refers to the labeled portion of the widget, not the actual display portion itself… and both can be adjusted by inputs from code and app.

You are using direct pin manipulation of the app, so when widgets are assigned to specific pins, as I understand it, the Blynk library takes over with necessary functions like pinmode (input/output, etc.) assignments.

When using analog pins, there can be some cases where the data can float… this is sometimes due to how a sensor is wired, and sometimes neighboring analog pins can also affect the actual pin values.

With some of my testing on various arduino like boards, I have also noticed strange values coming from analog pins… but as I usually avoid direct pin manipulation, via the app, and prefer to use virtual pins, I honestly can’t be sure if it is a Blynk library issue or just the nature of analog pins needing clear and specific settings (pinmode setting in the code and properly wired sensors) in order to react precisely.

You can try comparing both A0 and A1 with one App Display Widget being directly referenced to analog pin A0 and another Display Widget being referenced to a virtual pin V1 and then adding something like this in your code (placed in the main loop for this example, but normally set to a timer to avoid data flooding)

void loop()
{
  Blynk.run();
  Blynk.virtualWrite(V1, analogRead(1));  // This reads the value of A1 and sends it to virtual pin V1
}

Then you can alternate the two sensors (assuming they are different types) between A0 and A1 to compare the incoming data from the two different ways of reading the pins.

Yes thank you very much! i solved the problem using virtual pins instead of direct pin read :blush:
now it works perfectly!