I have been trying to get a ESP-01 and HW-655 relay board. I understand that the serial code needs to be sent via the esp to another chip on the relay board
I have loaded the blink code that operates the relay using this serial information. Works fine
I have got Blynk talking to the ESP-01 and I can turn the blue LED on and off on GPIO1
Tried using the Virtual pin to run the code to send the serial string. When I press the button on the IOS app nothing happens. The GPIO Pin will turn the LED on perfect.
I am sure I am missing something really simple but can not work it out.
I am using Blynk server and Blynk Library version 0.6.1
'/*control relay looking at virtual pin sent from Blynk and serial writing commands to chip onboard Relay board - works */
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "yourAuthToken";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "yourSSID";
char pass[] = "yourPassword";
byte relON[] = {0xA0, 0x01, 0x01, 0xA2}; //Hex command to send to serial for open relay
byte relOFF[] = {0xA0, 0x01, 0x00, 0xA1}; //Hex command to send to serial for close relay
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// You can also specify server: (Blynk sample code)
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
}
// Relay on off
BLYNK_WRITE(V0) {
int button = param.asInt(); // read button
if (button == 1) {
Serial.write(relON, sizeof(relON));
}
else {
Serial.write(relOFF, sizeof(relOFF));
}
}
void loop()
{
Blynk.run();
}'