Python LimitlessLED via RF

Changes To Python LimitlessLED via RF
Login

Changes To Python LimitlessLED via RF

Changes to "Python LimitlessLED via RF" between 2020-04-28 18:08:29 and 2020-04-28 18:49:21

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45













































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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))