Beginning with ESP32
I hope you were playing with Arduino Uno which has 6 Analog to Digital converter pins (ADC). Now let us see the monster (compared to Arduino Uno) which has 16 (or 18) Analog to Digital converter pins.
Now, I’m going to introduce you the basic LED emitting test that we can do using ESP32 board.
In the board itself, we can see an LED other than power LED linked with pin number 2. That LED is similar to the LED which we can see in Arduino Uno at pin number 13. (Read about Arduino inbuilt LED here)
So how to handle ESP32 ‘s inbuit LED?
Since we have set Arduino IDE to program the ESP32 through this method, let us see how the things can be done in Arduino IDE.
Initially we have to set the pin number to make an output. As we all know, in ESP32, the pin number 2 has to be set. So in the sketch we shall name a variable called LED_BUILTIN. Now decide yourself that what would be the suitable type of that variable? Exactly yes, it is INTEGER.
So, define and in initialize the variable as
int LED_BUILTIN = 2;
Now we must make the setup for this simple electric connection as follows.
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
Then we have to define the loop in which the system has to work until the interruption occurs. So we have to do like this.
void loop() {
digitalWrite(LED_BUILTIN, HIGH); //To on the LED
delay(1000); //LED will be on for 1000 milliseconds (1 second)
digitalWrite(LED_BUILTIN, LOW); //To off the LED
delay(1000); //LED will be off for 1000 milliseconds (1 second)
}
You can see a blue light getting emitted for every 1 second and last for a second. As you were playing in Arduino Uno, start sketching the networks with the understanding of the pins.
Good Luck!