EasyManua.ls Logo

Keyestudio ESP32 - 3. Wiring Diagram; 4. Test Code

Keyestudio ESP32
344 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
ESP32 Starter Kit
3. Wiring Diagram
4. Test Code
We adopts analogRead(Pin) function to read the analog value. Connect the sensor to IO34 pin, and the value will be
printed on the serial monitor.
/*
keyestudio ESP32 Inventor Learning Kit
Project 20.1 Light Pillar
http://www.keyestudio.com
*/
int light = 34; //Define light to IO34
void setup() {
// put your setup code here, to run once:
Serial.begin(9600); //Set baud rate to 9600
}
void loop() {
// put your main code here, to run repeatedly:
int value = analogRead(light); //Read IO34 and assign it to the variable value
Serial.println(value); //Print the variable value and wrap it around
delay(200);
}
118 Chapter 8. Arduino Tutorial

Table of Contents