1.1 Controlling LED & Buzzer Using Serial Monitor Interfacing with ESP32
1.1 Controlling LED & Buzzer Using Serial Monitor Interfacing with ESP32
ESP32
Aim: Controlling LED & Buzzer using Serial Monitor Interfacing with ESP32 board.
Apparatus:
• Development Board
• ESP32 board
• LED
• Buzzer
• 12V Adaptor
• Power jack
• USB Cable
• Jumper Wires
Hardware Procedure:
• LEDs in Development Board LED, Buzzer pins connected to D13, D12 pins of ESP32
board.
• Power jack is connected to the ESP32 board.
• USB connector is connected to ESP32 board and CPU.
• Connect the 12V power supply to development board.
• Upload corresponding program into ESP32 board
• Switch ON Power supply.
Software Procedure:
1. Click on Arduino IDE
2. Click on file
3. Click on New
4. Write a Program as per circuit Pin connections
5. Click on Save
6. Click on Verify
7. Click on tools select ESP32 board and select port.
8. Click on Upload the code into ESP32 board by using USB cable.
9. Go to tools click on serial plotter verify the output in graph format.
Code:
char input;
void setup()
Serial.begin(9600);
pinMode(led, OUTPUT);
pinMode(buzzer, OUTPUT);
digitalWrite(led, LOW);
digitalWrite(buzzer, LOW);
void loop()
if(Serial.available())
input = Serial.read();
if(input == '0')
digitalWrite(led, LOW);
if(input == '1')
digitalWrite(led, HIGH);
if(input == '2')
digitalWrite(buzzer, HIGH);
if(input == '3')
digitalWrite(buzzer, LOW);
}
Precautions:
Output: LED & Buzzer are controlled by serial monitor with esp32.