I recently came to know that Blynk has restrictions with delay. I want to blink 3 leds one after other like traffic signal lights with 1 sec frequency. Below is the code which is run on arduino normally. How can I do that without delay in Blynk. Please help me how to write that one line.
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX
#include <BlynkSimpleStream.h>
BlynkTimer timer;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "bML9YS";
const int Green=2;
const int Orange=3;
const int Red=4;
void setup()
{
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
Serial.begin(9600);
Blynk.begin(Serial, auth);
}
void loop()
{
Blynk.run();
timer.run();
BLYNK_WRITE(V1)
}
BLYNK_WRITE(V1)
{
if(param.asInt() == 1)
{
digitalWrite(2, LOW);digitalWrite(3, LOW);digitalWrite(4, HIGH); delay(2000);
digitalWrite(2, LOW);digitalWrite(3, HIGH);digitalWrite(4, LOW); delay(2000);
digitalWrite(2, HIGH);digitalWrite(3, LOW);digitalWrite(4, LOW); delay(2000);
}
else
{
digitalWrite(2, LOW);digitalWrite(3, LOW);digitalWrite(4, LOW);
}
}