#include "WiFi.h"
const char* ssid = "Wokwi-GUEST";
const char* password = "";
const int redPin = 15;
const int yellowPin = 2;
const int greenPin = 4;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
WiFi.begin(ssid, password);
Serial.println("Hello, ESP32!");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.println("Connecting to WiFi..");
}
Serial.println("Connected to the WiFi network");
// Print local IP address and start web server
Serial.println("");
Serial.println("WiFi connected.");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
// setup pin 5 as a digital output pin
pinMode (redPin, OUTPUT);
pinMode (yellowPin, OUTPUT);
pinMode (greenPin, OUTPUT);
}
void loop() {
digitalWrite (redPin, HIGH); // turn on the LED
Serial.println("Red light is on");
delay(500); // wait for half a second or 500 milliseconds
digitalWrite (redPin, LOW); // turn off the LED
Serial.println("Red light is off");
delay(500); // wait for half a second or 500 milliseconds
digitalWrite (yellowPin, HIGH); // turn on the LED
Serial.println("Yellow light is on");
delay(500); // wait for half a second or 500 milliseconds
digitalWrite (yellowPin, LOW); // turn off the LED
Serial.println("Yellow light is off");
delay(500); // wait for half a second or 500 milliseconds
digitalWrite (greenPin, HIGH); // turn on the LED
Serial.println("Green light is on");
delay(500); // wait for half a second or 500 milliseconds
digitalWrite (greenPin, LOW); // turn off the LED
Serial.println("Green light is off");
delay(500); // wait for half a second or 500 milliseconds
}