#define BLYNK_TEMPLATE_ID "TMPLHdv45DrF"
#define BLYNK_DEVICE_NAME "smart plug"
#define BLYNK_AUTH_TOKEN "6CnMexoq3rmE0suD1QCddtZa1BAvarFm"
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "6CnMexoq3rmE0suD1QCddtZa1BAvarFm";
char ssid[] = "golden";
char pass[] = "66666666";
int Relay5 = D5;
int Relay6 = D6;
int Relay7 = D7;
int Relay8 = D8;
void setup()
{
pinMode(Relay5,OUTPUT);
pinMode(Relay6,OUTPUT);
pinMode(Relay7,OUTPUT);
pinMode(Relay8,OUTPUT);
// Debug console
Serial.begin(9600);
delay(100);
Blynk.begin(auth, ssid, pass);
BLYNK_WRITE(V1)
{
if (param.asInt()==1){
digitalWrite(Relay5,HIGH);
Blynk.virtualWrite(V1, 1);
}else {
digitalWrite(Relay5,LOW);
Blynk.virtualWrite(V1, 0);
}{Blynk.connect();}
{BLYNK_CONNECTED()}
}
BLYNK_WRITE(V2)
{
if (param.asInt()==1){
digitalWrite(Relay6,HIGH);
Blynk.virtualWrite(V2, 1);
}else {
digitalWrite(Relay6,LOW);
Blynk.virtualWrite(V2, 0);
}
}
BLYNK_WRITE(V3)
{
if (param.asInt()==1){
digitalWrite(Relay7,HIGH);
Blynk.virtualWrite(V3, 1);
}else {
digitalWrite(Relay7,LOW);
Blynk.virtualWrite(V3, 0);
}
}
BLYNK_WRITE(V4)
{
if (param.asInt()==1){
digitalWrite(Relay8,HIGH);
Blynk.virtualWrite(V4, 1);
}else {
digitalWrite(Relay8,LOW);
Blynk.virtualWrite(V4, 0);
}
}
{Blynk.connect();}
{BLYNK_CONNECTED()}
void loop()
{
Serial.begin(115200);
delay(100);
digitalWrite(Relay5, LOW);
digitalWrite(Relay6, LOW);
digitalWrite(Relay7, LOW);
digitalWrite(Relay8, LOW);
Blynk.run();
}
มันขึ้นแบบนี้อะครับ
Arduino:1.8.20 Hourly Build 2022/04/25 09:33 (Windows 10), บอร์ด:"NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 57600"
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00000604 (most recent call first):
exit status -1073740791
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
นี่อะครับ ขอบคุณล่วงหน้านะครับ