Skip to content

Commit

Permalink
Add a simple bulk data command
Browse files Browse the repository at this point in the history
  • Loading branch information
cibomahto committed Jan 24, 2016
1 parent 6daf0a3 commit b77809f
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions BlinkyTape.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ def send_list(self, colors):
def send_list(self, colors):
data = ""
for r, g, b in colors:
if r >= 255:
r = 254
if g >= 255:
g = 254
if b >= 255:
b = 254
data += chr(r) + chr(g) + chr(b)

data = data.replace(chr(255),chr(254))

self.serial.write(encode(data))
self.show()

def sendData(self, data):
data = data.replace(chr(255), chr(254))
self.serial.write(encode(data))
self.show()

Expand All @@ -81,19 +83,9 @@ def sendPixel(self, r, g, b):
Throws a RuntimeException if [ledCount] pixels are already set.
"""
data = ""
if r < 0:
r = 0
if g < 0:
g = 0
if b < 0:
b = 0
if r >= 255:
r = 254
if g >= 255:
g = 254
if b >= 255:
b = 254
data = chr(r) + chr(g) + chr(b)
data = data.replace(chr(255),chr(254))

if self.position < self.ledCount:
if self.buffered:
self.buf += data
Expand Down

0 comments on commit b77809f

Please sign in to comment.