// This program is designed to control an LED connected to GPIO4 of the ESP32.
// The LED will blink on and off every second, and the status of the LED (ON or OFF) will be printed to the Serial Monitor.
// The setup function runs once when the ESP32 starts up or is reset.
void setup() {
// Set the LED pin (GPIO4) as an output.
pinMode(4, OUTPUT);
// Start the Serial communication at a baud rate of 9600.
// This allows us to print messages from the ESP32 to the Serial Monitor in the Arduino IDE.
Serial.begin(9600);
}
// The loop function runs over and over again forever after the setup function has completed.
void loop() {
// Turn the LED on (HIGH is the voltage level).
digitalWrite(4, HIGH);
// Print a message to the Serial Monitor indicating that the LED is on.
Serial.println("LED is ON");
// Wait for 1 second (1000 milliseconds).
delay(1000);
// Turn the LED off by making the voltage LOW.
digitalWrite(4, LOW);
// Print a message to the Serial Monitor indicating that the LED is off.
Serial.println("LED is OFF");
// Wait for 1 second (1000 milliseconds).
delay(1000);
}