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 - Python Tutorial
From the course: Learning CircuitPython with Circuit Playground Express
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Microcontroller principles2m 16s
-
(Locked)
The Circuit Playground Express (CPX)2m 51s
-
(Locked)
Controlling the CPX onboard LED3m 39s
-
(Locked)
More controlling the CPX onboard LED4m 11s
-
(Locked)
Meet the REPL4m 58s
-
(Locked)
NeoPixels intro5m 30s
-
(Locked)
NeoPixels programming4m 42s
-
(Locked)
NeoPixels advanced programming4m 54s
-
(Locked)
-
-
-