Basic physical LED Control via Blynk

Shouldn’t this be:

BLYNK_WRITE(V21) //Function Mode 1
{
int Mode1 = param.asInt(); //Get value from Button V21
if (Mode1 == 1) { //if it is HIGH
varMode1++; //count the flag “varMode1” ++
}
if (varMode1 == 2) { //if the Button get pushed a second one
varMode1= 0; //flag “varCentralOut” is again 0
}

As Mode1 will never be 2 if the button is sending 1 and 0

No mode1 is only the status from the button. I know it can be only 1 or 0… if this button is clicked I sai to the variable varMode1 count on. By the first click it counts to 1. By the second click it counts to 2, but immediatelly after I say if varMode1 == 2, varMode1 = 0. So it can begin from new

Yes, but your if statement is looking for Mode1 to be equal to 2.

No, it says

Or am I missing something here…

Sorry there was an error by my side, that happens if you code on blynk website. :wink:
But also if I write it like you, and also in my sketch it does not work. My question: How to compare two variables? There must be the error because in serial monitor I see if I click on Button from Mode 1 that varMode1 == 1 and the same also with the Button centralOut. But I never get the varLedOutput == 1. It remains usually 0. Tomorrow I will copy my original sketch here. :slight_smile:
Thx. in the meantime

I checked your past posts and you are using the wrong character in code formatting…

Do not use the tilde character, use the backtick character… same key, different character :stuck_out_tongue_winking_eye: And don’t forget the cpp at the beginning.

Blynk - FTFC