Python LimitlessLED via RF

Artifact [4333d6a55e]
Login

Artifact [4333d6a55e]

Artifact 4333d6a55e607b743c57bddcc6da7af2c625966e1ddffb5f784b88aa1f94de88:

Wiki page [Python LimitlessLED via RF] by rkeene on 2020-04-28 18:08:07.
D 2020-04-28T18:08:07.938
L Python\sLimitlessLED\svia\sRF
N text/x-markdown
U rkeene
W 1227
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 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 2842d31cfefbee14ffe1b9b400b11271