โค้ดครับ
#define BLYNK_TEMPLATE_ID "TMPLf_VEI5xH"
#define BLYNK_DEVICE_NAME "Quickstart Device"
#define BLYNK_AUTH_TOKEN "X5zwImlUNpugTUixUBav5_NeUB345PWx"
// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <PMS.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
char Relay1 = 8;
char auth[] = BLYNK_AUTH_TOKEN;
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "E = mc2";
char pass[] = "zxkeq8vo9i931";
PMS pms(Serial);
PMS::DATA data;
LiquidCrystal_I2C lcd(0x27, 16, 2);
byte auto_relay = 0;
float dust_auto = 0;
BLYNK_CONNECTED()
{
// Change Web Link Button message to "Congratulations!"
Blynk.syncAll();
}
void setup()
{
// Debug console
Serial.begin(9600);
pinMode(Relay1, OUTPUT);
Blynk.begin(auth, ssid, pass);
Blynk.
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
// Setup a function to be called every second
Blynk.connect();
}
BLYNK_WRITE(V2)
{
// Set incoming value from pin V0 to a variable
if (param.asInt()==1){
analogWrite(Relay1, 255);
}
else{
analogWrite(Relay1, 0);
}
//Update state
}
void loop()
{
Blynk.run();
}
พออัปลงบอร์ด แล้วพอปล่อย wifi มันขึ้นแบบนี้อะครับ