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

How it works...

The first line of code imports the Circuit Playground Express library. This library contains an object class called express, which is the main class that we will use to interact with the hardware on this board. When the library is imported, it creates an instance of this class called cpx.

The cpx object exposes a property called red_led. This property can be used to retrieve the current value of the LED. If the LED is on, it will return the True value; otherwise, if the LED is off, it will return the False value. Setting the value of this property will turn the LED on or off depending on whether a True or False value is set.