LED controll using Blynk App
Code for LED ON/OFF Using blynk app with NODEMCU
#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[] = "36F6Titc54BVme6b1ffrDCU0bAauTvMg";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Name";
char pass[] = "Password";
void setup()
{
pinMode(D1,OUTPUT);
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
BLYNK_WRITE(1)
{
int led = param.asInt();
if(led==1)
digitalWrite(D1,HIGH);
else
digitalWrite(D1,LOW);
}
void loop()
{
Blynk.run();
}
Comments
Post a Comment