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.

More controlling the CPX onboard LED

More controlling the CPX onboard LED - Python Tutorial

From the course: Learning CircuitPython with Circuit Playground Express

Start my 1-month free trial

More controlling the CPX onboard LED

- [Instructor] In this video, we'll explore more uses for variables in LED blinking. Here's the loop part of our blink program. It uses a variable for sleep time. Each time through the loop, the timing is the same so the blink rate is constant. But what if we want the blink to be faster each time through the loop? Variables make this easy. The last line here updates sleep time each time through the loop, multiplying the original sleep time by 0.8 reduces the sleep time by 20% each time. Now, let's go to the desktop to see how this works in practice. Here we are on the desktop, the first thing I'm going to do is open up Atom. Make it full screen. I'm going to open up the main .pi file on our circuit pi drive. You see here we have the standard blink program with a variable set 0.5. So to make a variable blink all we have to do is add a sleep time, equals sleep time (keys clacking) times 0.8 here. Now you…

Contents