From the course: Learning CircuitPython with Circuit Playground Express

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Controlling the CPX onboard LED

Controlling the CPX onboard LED - Python Tutorial

From the course: Learning CircuitPython with Circuit Playground Express

Start my 1-month free trial

Controlling the CPX onboard LED

- [Instructor] We've covered the foundations of microcontrollers and programming with CircuitPython. Now it's time to dive a little deeper into the CircuitPython language. This is the simple blink program we've used so far. You're familiar with the structure by now including modules, setting up the LED and a loop. And you've used LED on/off and sleep statements to program different blinking behavior. So far we've manually adjusted all of the sleep intervals by entering new numbers each time. These numbers are called constants because once set, they don't change. There's another way to set values however, that's by using a variable. Here's an example, in this statement, the value 0.5 is being assigned to the variable named sleep_time from then on, when you refer to sleep_time, the program will use the value 0.5. Let's go to the desktop to see how we can use this in our blink program. First thing I'm going to do is open…

Contents