#define BLYNK_TEMPLATE_ID "TMPL2hapqkkx9"
#define BLYNK_TEMPLATE_NAME "ROAD MOBILE TRAFFIC CONTROL SYSTEM"
#define BLYNK_AUTH_TOKEN "QRn1aFL-u7iJIqndD21dcD5tnXs6yPNN"
#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
// WiFi credentials
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
// Virtual pins to control the lights
#define LIGHT1_PIN V0
#define LIGHT2_PIN V1
#define LIGHT3_PIN V2
void setup() {
Serial.begin(9600);
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
// Setup pins for LED outputs
pinMode(11, OUTPUT); // Built-in LED pin
pinMode(12, OUTPUT); // Change this pin number for the second LED
pinMode(13, OUTPUT); // Change this pin number for the third LED
}
void loop() {
Blynk.run();
}
// Blynk functions to control the lights
BLYNK_WRITE(LIGHT1_PIN) {
int lightState = param.asInt(); // Get the state of the light from the app
digitalWrite(12, lightState); // Control the first LED
}
BLYNK_WRITE(LIGHT2_PIN) {
int lightState = param.asInt(); // Get the state of the light from the app
digitalWrite(13, lightState); // Control the second LED
}
BLYNK_WRITE(LIGHT3_PIN) {
int lightState = param.asInt(); // Get the state of the light from the app
digitalWrite(14, lightState); // Control the third LED
}