ESP32 Starter Kit
3. Wiring Diagram
4. Test Code
According to previous principles, we can control LED via levels of ESP32 pins.
1. Define an variable as pin IO5 used for pin number modification.
2. Set pin IO5 to output mode in setup( ).
3. Set pin IO5 to output “HIGH” and “LOW” and delay for 1s respectively.
4. As a result, LED will be on and off for 1s.
/*
keyestudio ESP32 Inventor Learning Kit
Project 1: LED Blinking
http://www.keyestudio.com
*/
int ledPin = 5; //Define LED to connect with pin IO5
void setup() {
pinMode(ledPin, OUTPUT);//Set the mode to output
}
(continues on next page)
46 Chapter 8. Arduino Tutorial