LEDs (Controlling using Python)

Learn to program using LED strips controlled by a Raspberry Pi.

Setup:

  • [Optional] Make your own Pi Strip. (Skip if you already have a device).
  • Install Thonny: You can use any python interpreter, but Thonny makes it easier when you set the interpreter to CircuitPython.
    • Set the interpreter to CircuitPython: either on the bottom right corner of the Thonny Window or through Tools-> Options -> Interpreter. You may also need to set the Port to "RPi" in the Interpreter window.
    • Linux: you may have to run the command sudo usermod -a -G dialout $USER.

Coding Lessons

Basic coding by controlling a LED light strip using a Raspberry Pi. The default is for the Raspberry Pi Pico Strips. The code is almost identitical for the Pi computers and the Pico microcontroller, however, they just use different default GPIO pins (board.D18 vs board.GP0)
  1. Lighting Lights (Basics)
  2. for Loops (with light sequences)
  3. Functions
  4. if statements
  5. while Loops