Reversible Switch Logic

In the app I see that I have a “Low -/- High” graphic in every other widget I can modify this graphic as I need. I cant modify a switch to be “HIGH/LOW” (the reverse)

Using the cheap optio isolator relay boards they switch on with High.

So when I click a button in the blynk app it lights up green for “on” but really my circut is off, so I either need to invert logic with a chip in hardware (not ideal) or need to dig into the library and reverse logic in software (not ideal for what Blynk is here for)

So could I please request that that logic for switches is “reversable”

1 Like

yes, we will do that. Great comment!

2 Likes

also applies to the LED widget - I am working thru each example code and coming up with lots of ideas here…

So excited for this project its simply amazing I love it so much guys!

hello…
I have apply this change in BlynkApiArduino.h :slight_smile:
if (!strcmp(cmd, “dw”)) {
//BLYNK_LOG(“digitalWrite %d -> %d”, pin, it.asInt());
pinMode(pin, OUTPUT);
digitalWrite(pin, !it.asInt() ? HIGH : LOW);
!it.asInt()
! to invert the digital value!!
its work good…

@toreg, :grinning:
Well that’s funny ) just remember it will impact all of the pins. A better way would be to create a virtual pin and reverse the logic there. Cheers!

1 Like

Better make it changeble :smile:

Can you explain how to write the code to do this?

Oh yes, please , Pavel… implement this :innocent: