Skip to content

MicroPython driver for P9813 chainable RGB LEDs

License

Notifications You must be signed in to change notification settings

edbaafi/micropython-p9813

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MicroPython P9813

A MicroPython library for P9813 RGB LED drivers.

For example, the Seeed Studio Grove - Chainable RGB LED.

demo

Example

Copy the file to your device, using ampy, webrepl or compiling and deploying. eg.

$ ampy put p9813.py

Basic usage

from machine import Pin
import p9813

pin_clk = Pin(5, Pin.OUT)
pin_data = Pin(4, Pin.OUT)

num_leds = 10
chain = p9813.P9813(pin_clk, pin_data, num_leds)

# set the first LED to red
chain[0] = (255, 0, 0)

# set the second LED to green
chain[1] = (0, 255, 0)

# write data to all LEDs
chain.write()

# make all LEDs red
chain.fill((255,0,0))
chain.write()

# turn off all LEDs
chain.reset()

See p9813_examples.py and examples for more.

Parts

Connections

WeMos D1 Mini Grove Chainable RGB LED
D1 (GPIO5) CI (clock) (yellow)
D2 (GPIO4) DI (data) (white)
3V3 (or 5V) VCC (red)
G GND (black)

If you are chaining multiple LEDs, clock out -> clock in, data out -> data in, eg.

LED1 LED2
CO CI (yellow)
DO DI (white)
VCC VCC (red)
GND GND (black)

Links

License

Licensed under the MIT License.

About

MicroPython driver for P9813 chainable RGB LEDs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%