.
D 2020-04-28T18:08:29.958
L Python\sLimitlessLED\svia\sRF
N text/x-markdown
P 4333d6a55e607b743c57bddcc6da7af2c625966e1ddffb5f784b88aa1f94de88
U rkeene
W 1244
Python LimitlessLED via RF
==========================
Control LimitlessLED bulbs through a directly attached radio. The radio object must have an interface with a "`transmit`" method that formats messages as an LT8900 would over the air.
Example
-------
#! /usr/bin/env python3
import random
import time
import gpiozero
import limitlessled_rf
import lt8900_spi
def init_radio():
# Need to keep this attached to drive the line high -- if the object disappears then
# the GPIO port gets reconfigured as an input port
# Note: broadcom pin numbers are used
reset_gpio = gpiozero.LED(24)
reset_gpio.on()
def reset_module_via_gpio():
reset_gpio.off()
time.sleep(0.1)
reset_gpio.on()
time.sleep(0.1)
# LT8900 compatible radio
radio = lt8900_spi.radio(0, 0, {
'reset_command': reset_module_via_gpio,
'reset_command_gpio': reset_gpio
})
if not radio.initialize():
return None
return radio
radio = init_radio()
remote = limitlessled_rf.remote(radio, 'rgbw', 0x51F0)
while True:
remote.set_color(random.randint(0, 0xffffff))
Z d2b2e1380660998094f975e425107c10