Overview
Artifact ID: | 834849b2fd81e0ce681b1d7b4d1af7ce5bb3119a46359d2db0542b5bfe62b252 |
---|---|
Page Name: | Python LimitlessLED via RF |
Date: | 2020-04-28 18:08:29 |
Original User: | rkeene |
Mimetype: | text/x-markdown |
Parent: | 4333d6a55e607b743c57bddcc6da7af2c625966e1ddffb5f784b88aa1f94de88 (diff) |
Next | 06971c8291477508e07bc92ef0c6fb8b5392bb7eae8d6b70b36f7d263ff96240 |
Content
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))