Code Along - Chapter 21
ESP32: LOW, MID or HIGH
Sort 0-4095 readings into LOW, MID and HIGH with if and else.
ESP32 code on the virtual board
The virtual board is an Uno, not an ESP32, so there is no Wi-Fi here. You practise the code around it. A pot reading is a pretend number in a variable, like int reading = 2048;. The LED on GPIO 2 works the same; the test list calls it pin D2.
Exercise 21.1
LOW, MID or HIGH
The loop gives you three pretend readings, one at a time. For each one print:
LOWif it is below 1365MIDif it is below 2730HIGHotherwise
Sample output
LOW MID HIGH