Pages

Friday, 11 January 2019

ESP32-SEVEN SEGMENT DISPLAYS

ESP32-SEVEN SEGMENT DISPLAYS

Aim:
Interfacing ESP32-Microcontroller with seven segment display, to display the numbers.
Hardware Required:
ESP32-Microcontroller development board
Connections:


Pin Mapping:
A
I04
B
I012
C
I033
D
I032
E
I025
F
I026
DP
I05
D1
GND

Program:
void setup()
{
  // define pin modes
  
pinMode(4,OUTPUT); //Set pin D2-D9 as input pins
pinMode(12,OUTPUT);
pinMode(33,OUTPUT);
pinMode(32,OUTPUT);
pinMode(25,OUTPUT);
pinMode(26,OUTPUT);
pinMode(27,OUTPUT);
pinMode(5,OUTPUT);
 
}
 
void loop() 
{
  // print 0
  {
   digitalWrite(4,LOW);
   digitalWrite(12,LOW);
   digitalWrite(33,LOW);
   digitalWrite(32,LOW);
   digitalWrite(25,LOW);
   digitalWrite(26,LOW);
   digitalWrite(27,HIGH);
   digitalWrite(5,LOW);
   delay(1000);
  }
 // print 1
  
  {
   digitalWrite(4,HIGH);
   digitalWrite(12,LOW);
   digitalWrite(33,LOW);
   digitalWrite(32,HIGH);
   digitalWrite(25,HIGH);
   digitalWrite(26,HIGH);
   digitalWrite(27,HIGH);
   digitalWrite(5,LOW);
   delay(1000);
  }
 // print 2
{
   digitalWrite(4,LOW);
   digitalWrite(12,LOW);
   digitalWrite(33,HIGH);
   digitalWrite(32,LOW);
   digitalWrite(25,LOW);
   digitalWrite(26,HIGH);
   digitalWrite(27,LOW);
   digitalWrite(5,LOW);
   delay(1000);
  }
 
  // print 3
  {
   digitalWrite(4,LOW);
   digitalWrite(12,LOW);
   digitalWrite(33,LOW);
   digitalWrite(32,LOW);
   digitalWrite(25,HIGH);
   digitalWrite(26,HIGH);
   digitalWrite(27,LOW);
   digitalWrite(5,LOW); 
   delay(1000);
  }
  // print 4
  {
   digitalWrite(4,HIGH);
   digitalWrite(12,LOW);
   digitalWrite(33,LOW);
   digitalWrite(32,HIGH);
   digitalWrite(25,HIGH);
   digitalWrite(26,LOW);
   digitalWrite(27,LOW);
   digitalWrite(5,LOW);
   delay(1000);
  }
  // print 5
  {
   digitalWrite(4,LOW);
   digitalWrite(12,HIGH);
   digitalWrite(33,LOW);
   digitalWrite(32,LOW);
   digitalWrite(25,HIGH);
   digitalWrite(26,LOW);
   digitalWrite(27,LOW);
   digitalWrite(5,LOW);  
   delay(1000);
  }
  // print 6
  {
   digitalWrite(4,LOW);
   digitalWrite(12,HIGH);
   digitalWrite(33,LOW);
   digitalWrite(32,LOW);
   digitalWrite(25,LOW);
   digitalWrite(26,LOW);
   digitalWrite(27,LOW);
   digitalWrite(5,LOW);
   delay(1000);
  }
  // print 7
  {
   digitalWrite(4,LOW);
   digitalWrite(12,LOW);
   digitalWrite(33,LOW);
   digitalWrite(32,HIGH);
   digitalWrite(25,HIGH);
   digitalWrite(26,HIGH);
   digitalWrite(27,HIGH);
   digitalWrite(5,LOW);
   delay(1000);
  }
  // print 8
  {
   digitalWrite(4,LOW);
   digitalWrite(12,LOW);
   digitalWrite(33,LOW);
   digitalWrite(32,LOW);
   digitalWrite(25,LOW);
   digitalWrite(26,LOW);
   digitalWrite(27,LOW);
   digitalWrite(5,LOW);
   delay(1000);
  }
  // print 9
  {
   digitalWrite(4,LOW);
   digitalWrite(12,LOW);
   digitalWrite(33,LOW);
   digitalWrite(32,LOW);
   digitalWrite(25,HIGH);
   digitalWrite(26,LOW);
   digitalWrite(27,LOW);
   digitalWrite(5,LOW); 
   delay(1000);
  } 
}




ESP32-CONTROLLING LED USING SWITCH

ESP32-CONTROLLING LED USING SWITCH


Aim:
Controlling LED using a Switch
Objective:
Understanding the working of switch. Turn ON the led when switch is pressed and Turn off when it is released
Connections:
Pin Mapping:
Switch
I012
LED
I04

Program:
void setup() {
pinMode(4, OUTPUT);//Initialize the output pin 
pinMode(12, INPUT);//Switch is connected to pin 12
Serial.begin(9600);
}
 
// the loop function runs over and over again forever
void loop() { 
if (digitalRead(12)==HIGH)
{
digitalWrite(4, HIGH);// Turn the LED on
delay(1000);   // Wait for a second.
digitalWrite(4, LOW);  // Turn OFF LED
delay(1000); // Wait for a second.
}
}

ESP32- BLINKING AN LED

ESP32- BLINKING AN LED


Aim:
 Turn ON and OFF an LED after Particular delay
Objective:
To learn how to connect LED to digital pins of an ESP32 Microcontroller and program to blink an LED
Connections:
Pin Mapping:

LED
I04
Program:
void setup() {
pinMode(4, OUTPUT);//Initialize the output pin
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(4, HIGH);// Turn the LED on
 delay(1000);   // Wait for a second.

digitalWrite(4, LOW);  // Turn OFF LED
delay(1000); // Wait for a second.
}

Sunday, 6 January 2019

ESP32 INSTALLATION IN ARDUINO

ESP32 INSTALLATION IN ARDUINO

Step1:
Open the preferences window from the Arduino IDE. Go to File> Preferences

2.       Step2: Enter https://dl.espressif.com/dl/package_esp32_index.json into   the  “Additional  Board  Manager URLs”. Then, click the “OK” button

3.       Open boards manager. Go to Tools > Board > Boards Manager
4.       Select ESP32 by Espressif Systems and install it.