Pages

Tuesday, 15 March 2022

Blinking an LED

 

EXPERIMENT NO 1

                                        Blinking an LED

 

Aim:

Interfacing LED’s with ESP32-Microcontroller.

 

Description:

To learn how to programme an ESP32 Microcontroller to blink an LED by connecting an LED’S to its digital pins.

 

Hardware Requirement:

ESP32 IoT Development Kit and FRC cable.

 

 





Procedure:

1.      Connect P2 port and SV2(LED) port using FRC cable as shown above.

2.      Connect the USB cable to the board.

3.      Open Arduino IDE. Select DOIT ESP32 DEVKIT V1 in boards and select COM port.

4.      Now Write the program, verify and Upload it.

5.      Now you can see the LED blink on the ESP32 development board.

 

 Program:

const int L1=23, L2=22, L3=21, L4=19, L5=18, L6=5, L7=17, L8=16;  //initializing LED pins

void setup()

{

pinMode(L1, OUTPUT);       // Set all Port P2 pins as output

pinMode(L2, OUTPUT);

pinMode(L3, OUTPUT);

pinMode(L4, OUTPUT);

pinMode(L5, OUTPUT);

pinMode(L6, OUTPUT);

pinMode(L7, OUTPUT);

pinMode(L8, OUTPUT);

}

void loop()

{

digitalWrite(L1, HIGH);

digitalWrite(L2, HIGH);

digitalWrite(L3, HIGH);

digitalWrite(L4, HIGH);

digitalWrite(L5, HIGH);

digitalWrite(L6, HIGH);

digitalWrite(L7, HIGH);

digitalWrite(L8, HIGH);

delay(2000);

digitalWrite(L1, LOW);

digitalWrite(L2, LOW);

digitalWrite(L3, LOW);

digitalWrite(L4, LOW);

digitalWrite(L5, LOW);

digitalWrite(L6, LOW);

digitalWrite(L7, LOW);

digitalWrite(L8, LOW);

delay(2000);

}

No comments:

Post a Comment