🍞
Breadstick
  • Breadstick Innovations Website
  • Breadsticks
    • đŸĨ–Raspberry Breadstick
      • Code Examples
        • Demo Code
        • POV Wand
        • Pride Flags POV Wand
        • 6-Axis IMU
        • RGB Blink
        • AsyncIO RGB Blink
        • Digital Input
        • Digital Output
        • PWM
        • ADC
        • Servo Motor
    • đŸĨ–Raspberry Breadstick Lite
    • 🍞Support Boards
      • I2C Devices
        • 🚌I2C Bus Rail Adapter
        • đŸŒĻī¸Weather Crouton
        • 😎Brightness Crouton
        • 📏Distance Crouton
        • đŸĢ¨Motion Crouton
      • I2S Devices
        • đŸ“ĸBoombox
      • SPI Devices
      • đŸ•šī¸Buttons/Switches
    • Learning Resources
    • Troubleshooting
  • Nougat
    • Nougat C3
    • Nougat Quad
    • Installing WLED
  • Pico Slices
    • 🔴Slice 1 - LED Mixer
      • Assembly Guide
      • CircuitPython Code
        • 1 - Blink
        • 2 - Analog Read to Plotter
        • 3 - PWM Fade
        • 4 - Pot Controlled PWM
        • 5 - Gamma Correction
    • âąī¸Slice 2 - Stopwatch
      • Assembly Guide
      • Coding Lessons
        • 1 - 7-Segment Display Intro
        • 2 - Cycling Through All Segments
    • âŦœSlice 3 - 8x8 Dot Matrix
      • Assembly Guide
      • MicroPython Code
        • 1 - Moveable Pixel
        • 2 - Snake
    • Circuit Python Setup
    • Reset Bricked Pico
  • Christmas
    • Christmas Tree DIY kit
  • Protoboards
    • â¤ī¸Proto-Heart
    • đŸĨĒProto-Toast
  • SHOP
Powered by GitBook
On this page

Was this helpful?

  1. Breadsticks
  2. Raspberry Breadstick
  3. Code Examples

RGB Blink

Uses the DotStar library to blink the SK9822 addressable RGB LEDs.

Code

"""
Raspberry Breadstick RGB Blink
Breadstick Innovations
March 26, 2024

This code uses the DotStar library to blink 3 of the SK9822 RGB LEDs
"""

from board import *
from time import sleep
from adafruit_dotstar import DotStar

leds = DotStar(DOTSTAR_CLOCK, DOTSTAR_DATA, 24, brightness=0.02, auto_write=False)

RED = (255,0,0)
GREEN = (0,255,0)
BLUE = (0,0,255)
OFF = (0,0,0)

leds.fill(OFF)
leds.show()

while True:
    leds[0] = RED
    leds.show()
    sleep(0.1)
    
    
    leds[0] = OFF
    leds.show()
    sleep(0.1)
    
    leds[12] = GREEN
    leds.show()
    sleep(0.1)
    
    
    leds[12] = OFF
    leds.show()
    sleep(0.1)
    
    leds[23] = BLUE
    leds.show()
    sleep(0.1)
    
    
    leds[23] = OFF
    leds.show()
    sleep(0.1)
    
    
Previous6-Axis IMUNextAsyncIO RGB Blink

Last updated 1 year ago

Was this helpful?

đŸĨ–