MicroPython Cookbook
上QQ阅读APP看书,第一时间看更新

How it works...

The first line of code imports the Circuit Playground Express library. The constants for the green and black color are defined and the pixel brightness is then set to a comfortable level.

Then, an infinite loop is started, which executes two lines of code on each iteration. The first line will set the color of pixel 2 to green if push button A is pressed, otherwise, it will set the pixel to off. The second line will set the color of pixel 7 to green if push button B is pressed, otherwise, it will set the pixel to off.