/*************************************************************
Blynk is a platform with iOS and Android apps to control
ESP32, Arduino, Raspberry Pi and the likes over the Internet.
You can easily build mobile and web interfaces for any
projects by simply dragging and dropping widgets.
Downloads, docs, tutorials: https://www.blynk.io
Sketch generator: https://examples.blynk.cc
Blynk community: https://community.blynk.cc
Follow us: https://www.fb.com/blynkapp
https://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example runs directly on ESP8266 chip.
NOTE: This requires ESP8266 support package:
https://github.com/esp8266/Arduino
Please be sure to select the right ESP8266 module
in the Tools -> Board menu!
Change WiFi ssid, pass, and Blynk auth token to run :)
Feel free to apply it to any other example. It's simple!
*************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
/* Fill in information from Blynk Device Info here */
#define BLYNK_TEMPLATE_ID "TMPL68aEcLg2E"
#define BLYNK_TEMPLATE_NAME "Virtual Pin"
#define BLYNK_AUTH_TOKEN "zCRyQAhEYD58oxjs8GHBCKunh3LgzMXf"
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "BBPVP BEKASI ELECTRONIC";
char pass[] = "Bbpvp2024Elektro";
// char ssid[] = "Xiaomi 11T Pro";
// char pass[] = "12345678qw";
const int led = D1;
bool enable;
int setpoint;
BLYNK_WRITE(V0){
setpoint = param.asInt();
}
BLYNK_WRITE(V1){
enable = param.asInt();
}
void setup(){
Serial.begin(9600);
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
pinMode(led, OUTPUT);
}
void loop(){
Blynk.run();
if (setpoint >=25 && enable == 1 ){
digitalWrite(led, HIGH);
Blynk.virtualWrite(V2, 1);
Blynk.virtualWrite(V3, "LED Menyala");
}
else {
digitalWrite(led, LOW);
Blynk.virtualWrite(V2, 0);
Blynk.virtualWrite(V3, "LED Mati");
}
}