- MicroPython Cookbook
- Marwan Alsabbagh
- 65字
- 2021-06-24 14:28:19
How it works...
The first line of code imports the Circuit Playground Express library. The cpx object exposes a property called switch. This property will return True when the switch is in the left position, and False when it is in the right position.
The script loops forever with a 50 millisecond delay between each loop. The state of the slide switch is continually printed.