Hi, I’m trying to build a virtual wall for roomba vacuum cleaners.
I’ve whrite the code to simulate the virtual wall with wemos D1 and a infrared LED and it works well.
Now I want to swith on-off the virtual wall with Blynk with a simple Virtual Pin.
This is my sketch:
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
const uint16_t kIrLed = 4;
IRsend irsend(kIrLed);
BLYNK_WRITE(V5)
{
int pinValue = param.asInt();
if (pinValue == 1) {
digitalWrite (kIrLed, HIGH);
delay (1000);
}
else {
irsend.begin();
delay(1000);
}
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
irsend.enableIROut(38);
irsend.mark(1000);
irsend.space(1000);
Blynk.run();
}
The problem is that wen I press the button in Blynk App, the IR LED swithc off only for 1 second (delay 1000) and then restart to send the IR…
I think the problem is in the “void loop” but I can’t solve it.
Can anyone help me?
Thanks