Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

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

Topics

Resources

License

Packages

No packages published

Languages