0% found this document useful (0 votes)
48 views

1.3 Creating different led patterns and controlling them using push button switches interfacing with ESP32

IOT-1.3

Uploaded by

Mahaboob basha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

1.3 Creating different led patterns and controlling them using push button switches interfacing with ESP32

IOT-1.3

Uploaded by

Mahaboob basha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Creating different led patterns and controlling them using push

button switches interfacing with ESP32


Aim: Creating different led patterns and controlling them using push button switches interfacing
with ESP32 board.
Apparatus:
• Development Board

• ESP32 board

• LEDs

• Switches

• 12V Adaptor

• Power jack

• USB Cable

• Jumper Wires

Hardware Procedure:
• LED & Switch in Development Board LED1, LED2, LED3, SW I/P1, SW1/P2 pins
connected to D13, D12, D14, D23, D22 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;

const int led1 = 13;

const int led2 = 12;

const int led3 = 14;

const int sw1 = 23;

const int sw2 = 22;

void setup()

Serial.begin(9600);

pinMode(led1, OUTPUT);

pinMode(led2, OUTPUT);

pinMode(led3, OUTPUT);

pinMode(sw1, INPUT);

pinMode(sw2, INPUT);

digitalWrite(led1, LOW);

digitalWrite(led2, LOW);

digitalWrite(led3, LOW);

void loop()

if(digitalRead(sw1)==LOW)

{
digitalWrite(led1, HIGH);

delay(300);

digitalWrite(led1, LOW);

delay(300);

digitalWrite(led1, HIGH);

delay(400);

digitalWrite(led1, LOW);

delay(400);

digitalWrite(led2, HIGH);

delay(400);

digitalWrite(led2, LOW);

delay(400);

digitalWrite(led3, HIGH);

delay(400);

digitalWrite(led3, LOW);

delay(400);

if(digitalRead(sw2)==LOW)

digitalWrite(led3, HIGH);

delay(300);

digitalWrite(led3, LOW);

delay(300);

digitalWrite(led3, HIGH);

delay(400);
digitalWrite(led3, LOW);

delay(400);

digitalWrite(led2, HIGH);

delay(400);

digitalWrite(led2, LOW);

delay(400);

digitalWrite(led1, HIGH);

delay(400);

digitalWrite(led1, LOW);

delay(400);

Precautions:

• Take care about given power supply (12V).

• Jumper wires given carefully whenever given circuit connection.

Output: LEDs are controlled by Switches using esp32.

You might also like