ESP32 Starter Kit
5. Test Result
Connect the wiring and upload the code. The answers of respondents are only valid when the red LED is off(red
button is pressed). When someone presses his/her button(yellow, green or blue), the appropriate LED as well as the
red counterpart light up. By now, rest of LED cannot turn on when pressing buttons. The responding action can be
performed only when the red button is pressed again.
6. Code Explanation
while(1) { . . . } Unlimited loop function. When the expression or value in while() is True, the execution circulates in
while{}. On the contrary, the loop quits when it is False. In this example, “1” in while(1) represents True, so code is
on a loop when entering “while”, which is endless.
For how to exit, we need a “break” statement.
break; It is used to exit a loop.
8.5.17 Project 16: Timebomb
1. Description
This project will give you an opportunity experience an interesting timebomb game.
In this project, the dot matrix represents your timebomb, while the digital tube displays remaining time. Buttons can
not only control the bomb but also set its time. You may set a countdown to control this bomb, and it explodes when
the countdown is over. Beyond that, a buzzer is adopted to alarm.
Anyhow, by programming on multiple sensors, your comprehensive capability of logic thinking can be enhanced.
100 Chapter 8. Arduino Tutorial