Hi, I have tried this code on my generic ESP8266 and it does what it’s supposed to do, namely my PC powers up when the code runs.
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <WakeOnLan.h>
WiFiUDP UDP;
WakeOnLan WOL(UDP);
const char* ssid = "xxx";
const char* password = "xxx";
void wakeMyPC() {
const char *MACAddress = "xx:xx:xx:xx:xx:xx";
WOL.sendMagicPacket(MACAddress); // Send Wake On Lan packet with the above MAC address. Default to port 9.
// WOL.sendMagicPacket(MACAddress, 7); // Change the port number
}
void setup()
{
WOL.setRepeat(3, 100); // Optional, repeat the packet three times with 100ms between. WARNING delay() is used between send packet function.
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
WOL.calculateBroadcastAddress(WiFi.localIP(), WiFi.subnetMask()); // Optional => To calculate the broadcast address, otherwise 255.255.255.255 is used (which is denied in some networks).
wakeMyPC();
}
void loop()
{
}
however I am a noob and can’t figure out how to integrate it into Blynk. I have tried this project but for some reason the board restarts every couple seconds (confirmed by the Monitor in the Arduino IDE). I suppose it’s the code but I’m too noob to fix it.
Any help appreciated. Thanks!