Mercurial > code > home > repos > homeauto
comparison service/garageArduino/garageArduino.py @ 845:edd2486d6e2c
rename
Ignore-this: 1e379baf7a8a5ae7cf361bd7c6228d7d
darcs-hash:20120825212332-312f9-08a24630ac0ab13635b81c3ab7e843e5634a2fb4
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sat, 25 Aug 2012 14:23:32 -0700 |
parents | 9cf01cee74f6 |
children | 55b68d1e8212 |
comparison
equal
deleted
inserted
replaced
844:1757fc19f992 | 845:edd2486d6e2c |
---|---|
68 | 68 |
69 def shiftbrite(self, colors): | 69 def shiftbrite(self, colors): |
70 """ | 70 """ |
71 shift out this sequence of (r,g,b) triples of 10-bit ints | 71 shift out this sequence of (r,g,b) triples of 10-bit ints |
72 """ | 72 """ |
73 current = "".join(bitstring.pack("0b01, uint:10, uint:10, uint:10", | 73 resetCurrent = "".join(bitstring.pack("0b01, uint:10, uint:10, uint:10", |
74 127, 127, 127).bytes | 74 127, 127, 127).bytes |
75 for loop in range(len(colors))) | 75 for loop in range(len(colors))) |
76 out = "".join(bitstring.pack("0b00, uint:10, uint:10, uint:10", | 76 out = "".join(bitstring.pack("0b00, uint:10, uint:10, uint:10", |
77 b, r, g).bytes | 77 b, r, g).bytes |
78 for r,g,b in colors) | 78 for r,g,b in colors) |
79 out = current + out | 79 out = resetCurrent + out |
80 self.ser.write("\x60\x06" + chr(len(out)) + out) | 80 self.ser.write("\x60\x06" + chr(len(out)) + out) |
81 msg = self.ser.readJson() | 81 msg = self.ser.readJson() |
82 assert msg == {"ok":1}, msg | 82 assert msg == {"ok":1}, msg |
83 | 83 |
84 class Index(PrettyErrorHandler, cyclone.web.RequestHandler): | 84 class Index(PrettyErrorHandler, cyclone.web.RequestHandler): |