MODULE 3

Embedded Systems [III]

Arduino IDE and programming ESP32

Arduino IDE is an intergrated development environment for programming Arduino boards.
Its a powerful micro-controller module and versatile tool that makes it easy to create and program interactive electronic projects.

ESP32 is a highly capable microcontroller with a wide range of features and capabilities such as dual cores,low power consumption
and compatibility with development frameworks which makes it a preffered choice for IoT applications.

The ESP32 is programmed using the Arduino IDE which involves installing the IDE, adding support for the ESP32 board, selecting the appropriate board variant,
connecting the ESP32 to your computer, writing a code in the Arduino IDE
and uploading it to the board.

An ESP32 NodeMCU32S PINOUT

Blinking internal onboard LED of ESP32

#define ONBOARD_LED 2

void setup () {
pinMode (ONBOARD_LED,OUTPUT);
}

void loop () {
delay (1000);
digitalWrite (ONBOARD_LED,HIGH);
delay (100);
digitalWrite (ONBOARD_LED,LOW);
}

>

Traffic lights LED based project with ESP32

const int led_green = 23; // Define the pin for the yellow LED
const int led_yellow = 22; // Define the pin for the red LED
const int led_red = 21; // Define the pin for the green LED

void setup() {
pinMode(led_yellow, OUTPUT); // Set the yellow LED pin as an output
pinMode(led_red, OUTPUT); // Set the red LED pin as an output,
pinMode(led_green, OUTPUT); // Set the green LED pin as an output
}

>void loop() {
digitalWrite(led_green, HIGH); // Turn on the green LED
digitalWrite(led_yellow, LOW);
digitalWrite(led_red, LOW);
delay(1000); // Wait for 1 second

digitalWrite(led_green, LOW);
digitalWrite(led_yellow, HIGH); // Turn on the yellow LED
digitalWrite(led_red, LOW);
delay(1000);

digitalWrite(led_green, LOW);
digitalWrite(led_yellow, LOW);
digitalWrite(led_red, HIGH); // Turn on the red LED
delay(1000);
}

>