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
Define a variable “distance” with the assignment of detected distance value by the ultrasonic module.
Next, Compare the distance value with 30cm. If it is smaller than 30cm, the servo will rotate to 180° for 5s. Otherwise,
the servo returns to 0°.
9.2. Scratch Project 323

Table of Contents