// Chage These Credentials with your Blynk Template credentials
// Chage These Credentials with your Blynk Template credentials
#define BLYNK_TEMPLATE_ID "TMPLgEYWyF6C"
#define BLYNK_DEVICE_NAME "Quickstart Template"
#define BLYNK_AUTH_TOKEN "lFQtqcHrsOtx9nJDJgw3joIT7MrvI8lD"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <Servo.h>
#include <LiquidCrystal_I2C.h>
Servo servo1, servo2;
const int greenLed = 12; // Change to the pin connected to the green LED
const int redLed = 14; // Change to the pin connected to the red LED
// Initialize the LCD with the I2C address, and the pin numbers for the data and control lines
LiquidCrystal_I2C lcd(0x27, 16, 2);
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Wokwi-GUEST"; // Change your Wifi/ Hotspot Name
char pass[] = ""; // Change your Wifi/ Hotspot Password
BLYNK_WRITE(V0)
{
int s0 = param.asInt();
servo1.write(s0);
Blynk.virtualWrite(V5, s0);
if (s0 == 90) { // First position of servo 1
digitalWrite(greenLed, HIGH);
digitalWrite(redLed, LOW);
} else if (s0 == 0) { // Second position of servo 1
digitalWrite(greenLed, LOW);
digitalWrite(redLed, HIGH);
}
}
BLYNK_WRITE(V1)
{
int s1 = param.asInt();
servo2.write(s1);
Blynk.virtualWrite(V6, s1);
if (s1 == 90) { // First position of servo 2
digitalWrite(greenLed, HIGH);
digitalWrite(redLed, LOW);
} else if (s1 == 0) { // Second position of servo 2
digitalWrite(greenLed, LOW);
digitalWrite(redLed, HIGH);
}
}
void setup()
{
Serial.begin(9600);
servo1.attach(15);
servo2.attach(13);
pinMode(greenLed, OUTPUT);
pinMode(redLed, OUTPUT);
digitalWrite(greenLed, LOW);
digitalWrite(redLed, LOW);
Blynk.begin(auth, ssid, pass);
// Initialize the LCD, turn on the backlight, and set the cursor to the first position
lcd.init();
// Print the text "Welcome" on the first line of the LCD
lcd.print("welcome to our first Charging station");
delay(2000);
}
void loop()
{
Blynk.run();
// Scroll the text to the left
lcd.scrollDisplayLeft();
// Delay for a short period of time
delay(200);
}