EasyManua.ls Logo

Keyestudio ESP32 - 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
Connect the sensor to pin IO33. Read the sound analog value through analogRead(Pin) function and print it on serial
monitor.
/*
keyestudio ESP32 Inventor Learning Kit
Project 21.1Sound Controlled LED
http://www.keyestudio.com
*/
int sound = 33; //Define sound as IO33
void setup(){
Serial.begin(9600);
pinMode(sound,INPUT);
}
void loop(){
int value = analogRead(sound);
Serial.println(value);
}
122 Chapter 8. Arduino Tutorial

Table of Contents