This code worked fine with the old version of Blynk, but not with the new one!

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();
}

@vossing Please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Copy and paste these if you can’t find the correct symbol on your keyboard.

Pete.

First of all, you appear to be missing the three lines of firmware configuration code from the web console > device > device info tab. These need to be the very first lines of code right at the top of your sketch.

Once you’ve done this, this line becomes redundant…

and you can change this…

to this…

Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);

after that it really depends what you mean by “doesn’t work” and it would also be useful too understand what you’ve done with datastreams and widgets.

Pete.

Thanks Pete, now I finally got it to work.

Svein