ESP32 Starter Kit
3. Wiring Diagram
4. Test Code
We can read the pin voltage value via "digitalRead(Pin)", 1 for high and 0 for low.
/*
keyestudio ESP32 Inventor Learning Kit
Project 13.1 Mini Lamp
http://www.keyestudio.com
*/
int
button
=
15;
int
value
=
0;
void
setup() {
Serial.begin(9600);
pinMode(button, INPUT);
input mode.
}
void
loop() {
value
=
digitalRead(button);//Read the button value
Serial.print("Key
Serial.println(value);
88
//Set the serial baud rate to 9600
//Connect the button pin to digital port 8 and set it
status:");
//Print "Key status:" on serial port
//Print the button variable on the serial port and
to␣
wrapping␣
(continues on next page)
Chapter 8. Arduino Tutorial
Need help?
Do you have a question about the ESP32 and is the answer not in the manual?
Questions and answers