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)
    
    

Last updated