I have been trying to get Virtual Pins working as discussed in this thread, but it is just not lighting the LED in the Blynk app. Other output pins are responding to Blynk controls, and the onboard LED (pin 5) and Serial writes are working as expected per the code below.
Any thoughts? Thanks.
char auth[] = "xxxxx";
char ssid[] = "xxxxx";
char pass[] = "xxxxx";
int testVal = 0;
int timer;
void setup() {
Serial.begin(115200);
pinMode(5, OUTPUT);
Blynk.begin(auth, ssid, pass);
timer = millis();
}
void loop()
{
if (millis() - timer > 2000) {
timer = millis();
testVal = 1 - testVal;
Serial.println(testVal);
if(testVal) {
digitalWrite(5, HIGH);
Blynk.virtualWrite(1, HIGH);
} else {
digitalWrite(5, LOW);
Blynk.virtualWrite(1, LOW);
}
}
Blynk.run();
}