RGB LED strip
This example demostrates how a 5m RGB LED strip (based on LPD6803 chip) is controlled over UPER1 SPI.
Requirements:
- Uper1 board
- LPD6803 5 meter LED strip (or similar)
- 12V power supply (for LED strip)
- Connection wires
Code:
from time import sleep from IoTPy.pyuper.uper import UPER1 from IoTPy.things.led_strip import LedStrip def shift(seq, n): n %= len(seq) return seq[n:] + seq[:n] with UPER1() as board, board.SPI("SPI0") as spi, LedStrip(spi) as leds: colors = [0xFF0000, 0xFFFF00, 0x00FF00, 0x0000FF, 0xFF00FF] while True: leds.set_colors(colors*10) colors = shift(colors, 1) sleep(0.2)