Problem with api & virtual pin

using “Write pin value via GET” API on the virtual pins, there is a change in status regardless of the value sent … you can also not enter the value, it changes status anyway …

Paste here the exact API calls you are making but don’t show your actual token.

My request:

http://myip.net:8080/xxxtoken/update/V6?value=1

same if sending:

http://myip.net:8080/xxxtoken/update/V6
or
http://myip.net:8080/xxxtoken/update/V6=0

the pin changes status with every request!!!

on the digital pins, the operation is correct

I have a button in SWITCH mode on V10, just checked the following and they worked as expected.

http://blynk-cloud.com/xxxtokenxxx/update/V10?value=1
http://blynk-cloud.com/xxxtokenxxx/update/V10?value=0
Was the project built on Android or iOS?

Do you have latest app and latest libraries?

Cloud or local server?

Is IP LAN or WAN?

IP is Wan, server is local, my virtual pin is switch
the server is updated to the latest version and also the library on the arduino CPU…
I use both Android and iPhone with the same project

try to send the request without the value … my server does the same thing …

Perhaps do a quick cloud server test and then we know the issue is with the local server.
Either local server is not correctly configured or a bug.

How is the Arduino connected to the server (Ethernet, USB, ESP etc)?
Which Arduino are you using?

I’m using arduino mega connected via Ethernet shield w5100 … the defect does it with all the virtual pins while the digital ones work fine … my software reads the status of the virtual pin to turn on or off a lamp, (ON if 1 it is OFF if 0) but at each call it performs state inversion

Why would you need that if you are using SWITCH mode and API calls?
I’m now suspecting you wrote bad code :slight_smile:

the code is simple …

BLYNK_WRITE(V6) {
 if (param.asInt() == 1 {
digitalWrite(6, HIGH); //Spegni alimentatore
} else {
digitalWrite(6, LOW); //Accendi alimentatore
}

with the API call I would like to set to 1 or 0 the virtual pin do not switch to every call

using blynk from the smartphone works all regularly, the defect shows up only with the API call

Slip a Serial.println() command in there to show param.asInt() and test on both local and cloud server.

tried … change the status of param to each call …
the strange thing is also that if I do not insert the value (http://myip.net:8080/xxxtoken/update/V6?value=) for him it is the same … should give a missed parameter error

You tried on local AND cloud server?

Actually if I skip the 0 or 1 it doesn’t show a missed parameter, presumably because it is taking the parameter as != 1 (but not actually zero).
This is confirmed in the Terminal widget I have in the project and DOES NOT turn the button off.

Anyway that is another issue and you should be entering the full url.

I try on the cloud and I’ll tell you later, thanks intently …

1 Like