/*************************************************************
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 ESP32 chip.
NOTE: This requires ESP32 support package:
https://github.com/espressif/arduino-esp32
Please be sure to select the right ESP32 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 "TMPxxxxxx"
//#define BLYNK_TEMPLATE_NAME "Device"
//#define BLYNK_AUTH_TOKEN "YourAuthToken"
#define BLYNK_TEMPLATE_ID "TMPL63YgT8Vqw"
#define BLYNK_TEMPLATE_NAME "D1 R32"
#define BLYNK_AUTH_TOKEN "2vX1l4S5LGlmlEi53iWfvJljMDI7Rlx4"
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Wokwi-GUEST"; //nama hotspot yang digunakan
char pass[] = ""; //password hotspot yang digunakan
#define D13 18
#define D12 19
#define LEDBiru D13
#define LEDMerah D12
BLYNK_WRITE(V0) {
int pinValue=param.asInt();
Serial.printf("nilai V0 = %d \n\r",pinValue);
digitalWrite(LEDBiru, pinValue);
}
BLYNK_WRITE(V1) {
int pinValue=param.asInt();
Serial.printf("nilai V0 = %d \n\r",pinValue);
digitalWrite(LEDMerah, pinValue);
}
void setup()
{
// Debug console
Serial.begin(9600);
pinMode(LEDBiru, OUTPUT);
pinMode(LEDMerah, OUTPUT);
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
}
void loop()
{
Blynk.run();
}