-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBLNKM.py
41 lines (33 loc) · 1.25 KB
/
BLNKM.py
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
import smbus
import time
ADDR_BLNKM = 0x09#Smart LED
bus = smbus.SMBus(1)
#solves issue if smbus file is not found on new image https://github.com/johnbryanmoore/VL53L0X_rasp_python/issues/13
def initialize():
bus.write_block_data(ADDR_BLNKM, 0x0, [0x6f]) #stop script
bus.write_block_data(ADDR_BLNKM, 0x0, [0x63, 0, 0, 0]) #Off
bus.write_block_data(ADDR_BLNKM, 0x0, [0x74, -20]) # Set time adjust
bus.write_block_data(ADDR_BLNKM, 0x0, [0x66, 150]) # Set fade adjust
def gotoRGB(R, G, B):
try:
bus.write_block_data(ADDR_BLNKM, 0x0, [0x6e, R, G, B]) #go to RGB color
except:
pass
print('LED i2c error...')
def fadetoRGB(R, G, B):
try:
bus.write_block_data(ADDR_BLNKM, 0x0, [0x63, R, G, B]) #fade to RGB color
except:
pass
print('LED i2c error...')
def fadetoHSB(H, S, B):
try:
bus.write_block_data(ADDR_BLNKM, 0x0, [0x68, H, S, B]) #fade to HSB color
except:
pass
print('LED i2c error...')
# Some other commands that I've used:
#bus.write_block_data(ADDR_BLNKM, 0x0, [0x70,1,1,0]) #play script
#bus.write_block_data(ADDR_BLNKM, 0x0, [0x42, 1, 0, 1, 150, -20]) # Set startup params
#$bus.write_block_data(ADDR_BLNKM, 0x0, [0x70,15,1,0]) #play script
#print "done"