diff options
author | lonkaars <loek@pipeframe.xyz> | 2021-08-13 13:58:12 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2021-08-13 13:58:12 +0200 |
commit | 63102954fa115629d3fef84c0e251aa1a8269201 (patch) | |
tree | 338ba2f15b5fe23e04767c5ebc5f84817dd9bf5b /driver.py | |
parent | a1821bb663f834295d94acaf3a8c531fb30848a9 (diff) |
working (still buggy)
Diffstat (limited to 'driver.py')
-rw-r--r-- | driver.py | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -4,6 +4,9 @@ import threading import time import sys +BEKEN_CHARACTERISTIC_NULL = 0x0001 +BEKEN_CHARACTERISTIC_LAMP = 0x002a + def makemsg(r, g, b, l=0): return bytes([ int(g > 0), g, @@ -21,7 +24,7 @@ class BekenConnection: def keep_alive(self): while True: - self.send(0x0001, bytes(10)) + self.send(BEKEN_CHARACTERISTIC_NULL, bytes(10)) time.sleep(10) def send(self, characteristic, message): @@ -53,6 +56,6 @@ if __name__ == "__main__": def user_input(): for line in sys.stdin: r, g, b, l = [ int(x, 16) for x in [ line.strip()[i:i+2] for i in range(0, 8, 2) ] ] - con.send(0x002a, makemsg(r, g, b, l)) + con.send(BEKEN_CHARACTERISTIC_LAMP, makemsg(r, g, b, l)) threading.Thread(target=user_input).start() |