ESP32 Starter Kit
8. Code Explanation
Note: Pin mode must be set to “input” when using the button module.
1. Judge whether the button is pressed. If so, this block expresses true.
2. Read the button value. When the button is not pressed, the value is 1. Or else, it is 0.
3. If the condition in the hexagon is true, “if” block will be executed. Otherwise, the program runs “else” according
to block.
234 Chapter 9. Scratch Tutorial