BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Read 2 virtual buttons from the app into an esp8266

esp8266

#1

Hey there i am new in this topic and i want to change a relais with Blynk.
I want to can toggle it with a switch on the blynk app and a timer.

void loop
{
if(V1 == 1) || (V2 == 1) {
digitalWrite( 2 , HIGH )
}
else{
digitalWrite( 2 , LOW )
}
}


#2

You need to format any posted code… as per the directions…

Blynk - FTFC

Meanwhile your void loop() should only contain the basics like blynk.run() while you put your sensor/relay/etc. controls in separate functions… some with a timed loop using BlynkTimer as nessesary.

I recommend you read through the Documentation & Help Center and try out the examples in the Sketch Builder (all these links are also at the top of this page) to get a good understanding of how programming with Blynk works…

http://docs.blynk.cc/#blynk-firmware-virtual-pins-control-blynk_writevpin

e.g.

BLYNK_WRITE(V0)  // Button Widget in SWITCH mode 
{   
  int value = param.asInt(); // Get value as integer
  digitalWrite( 2 , value );  // control GPIO with value
}