ESP-01S Relay Module
I can’t get this code to work with the new version of Blynk, it worked fine with the old version.
anyone know how i can get this to work with the new version of Blynk!
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "AUTHKODE_FROM_BLYNK";
char ssid[] = "NETWORK_NAME";
char pass[] = "PASSWORD";
const byte RelayON[] = {0xA0, 0x01, 0x01, 0xA2}; //Hex command to send to serial for open relay
const byte RelayOFF[] = {0xA0, 0x01, 0x00, 0xA1}; //Hex command to send to serial for close relay
BLYNK_WRITE(V0)
{
Serial.begin(9600);
int pinValue = param.asInt();
if (pinValue == 1) {
Serial.write(RelayON, sizeof(RelayON)); //turns relay ON
}
else {
Serial.write(RelayOFF, sizeof(RelayOFF)); //turns relay OFF
}
}
void setup()
{
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
}