Skip to content

Commit 11eed64

Browse files
authored
Merge pull request #1831 from Beau28713/adafruit_learning
adafruit_learning_systems issue #1784
2 parents a15271c + 3042f1b commit 11eed64

4 files changed

Lines changed: 40 additions & 40 deletions

File tree

BLE_Colorific/colorific.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929

3030
# Get bulb address from command parameters.
3131
if len(sys.argv) != 2:
32-
print 'Error must specify bulb address as parameter!'
33-
print 'Usage: sudo python colorific.py <bulb address>'
34-
print 'Example: sudo python colorific.py 5C:31:3E:F2:16:13'
32+
print ('Error must specify bulb address as parameter!')
33+
print ('Usage: sudo python colorific.py <bulb address>')
34+
print ('Example: sudo python colorific.py 5C:31:3E:F2:16:13')
3535
sys.exit(1)
3636
bulb = sys.argv[1]
3737

@@ -47,7 +47,7 @@
4747
hue = hue_min
4848

4949
# Enter main loop.
50-
print 'Press Ctrl-C to quit.'
50+
print ('Press Ctrl-C to quit.')
5151
last = time.time()
5252
while True:
5353
# Get amount of time elapsed since last update, then compute hue delta.

BLE_Colorific/flux.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030

3131
# Get bulb address from command parameters.
3232
if len(sys.argv) != 2:
33-
print 'Error must specify bulb address as parameter!'
34-
print 'Usage: sudo python colorific.py <bulb address>'
35-
print 'Example: sudo python colorific.py 5C:31:3E:F2:16:13'
33+
print ('Error must specify bulb address as parameter!')
34+
print ('Usage: sudo python colorific.py <bulb address>')
35+
print ('Example: sudo python colorific.py 5C:31:3E:F2:16:13')
3636
sys.exit(1)
3737
bulb = sys.argv[1]
3838

@@ -48,7 +48,7 @@
4848
hue = hue_min
4949

5050
# Enter main loop.
51-
print 'Press Ctrl-C to quit.'
51+
print ('Press Ctrl-C to quit.')
5252
last = time.time()
5353
while True:
5454
# Get amount of time elapsed since last update, then compute hue delta.
@@ -64,7 +64,7 @@
6464
# Set light color by sending color change packet over BLE.
6565
# 56RRGGBB00f0aa
6666
line = 'char-write-cmd 0x002e 56{0:02X}{1:02X}{2:02X}00f0aa'.format(r, g, b)
67-
print line
67+
print (line)
6868
gatt.sendline(line)
6969
# Wait a short period of time and setup for the next loop iteration.
7070
time.sleep(SLEEP_SEC)

Kinetic_POV/convert/convert.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,16 @@ def writeByte(n):
138138

139139
if image.bph > numLEDs: numLEDs = image.bph
140140

141-
print "// Don't edit this file! It's software-generated."
142-
print "// See convert.py script instead."
143-
print
144-
print "#define PALETTE1 0"
145-
print "#define PALETTE4 1"
146-
print "#define PALETTE8 2"
147-
print "#define TRUECOLOR 3"
148-
print
149-
print "#define NUM_LEDS %d" % numLEDs
150-
print
141+
print ("// Don't edit this file! It's software-generated.")
142+
print ("// See convert.py script instead.")
143+
print()
144+
print ("#define PALETTE1 0")
145+
print ("#define PALETTE4 1")
146+
print ("#define PALETTE8 2")
147+
print ("#define TRUECOLOR 3")
148+
print()
149+
print ("#define NUM_LEDS %d" % numLEDs)
150+
print()
151151

152152
# Second pass estimates current of each column, then peak & overall average
153153

@@ -221,9 +221,9 @@ def writeByte(n):
221221
int(pow((lut[i][0]/255.0),gamma)*bR1+0.5),
222222
int(pow((lut[i][1]/255.0),gamma)*bG1+0.5),
223223
int(pow((lut[i][2]/255.0),gamma)*bB1+0.5)))
224-
if i < (image.numColors - 1): print ","
225-
print " };"
226-
print
224+
if i < (image.numColors - 1): print (",")
225+
print (" };")
226+
print()
227227

228228
sys.stdout.write(
229229
"const uint8_t PROGMEM pixels%02d[] = {" % imgNum)
@@ -299,19 +299,19 @@ def writeByte(n):
299299
writeByte(0)
300300
writeByte(0)
301301

302-
print " };" # end pixels[] array
303-
print
302+
print (" };") # end pixels[] array
303+
print()
304304

305305
# Last pass, print table of images...
306306

307-
print "typedef struct {"
308-
print " uint8_t type; // PALETTE[1,4,8] or TRUECOLOR"
309-
print " line_t lines; // Length of image (in scanlines)"
310-
print " const uint8_t *palette; // -> PROGMEM color table (NULL if truecolor)"
311-
print " const uint8_t *pixels; // -> Pixel data in PROGMEM"
312-
print "} image;"
313-
print
314-
print "const image PROGMEM images[] = {"
307+
print ("typedef struct {")
308+
print (" uint8_t type; // PALETTE[1,4,8] or TRUECOLOR")
309+
print (" line_t lines; // Length of image (in scanlines")
310+
print (" const uint8_t *palette; // -> PROGMEM color table (NULL if truecolor")
311+
print (" const uint8_t *pixels; // -> Pixel data in PROGMEM")
312+
print ("} image;")
313+
print()
314+
print ("const image PROGMEM images[] = {")
315315

316316
for imgNum, image in enumerate(images): # For each image in list...
317317
sys.stdout.write(" { ")
@@ -338,6 +338,6 @@ def writeByte(n):
338338
else:
339339
print
340340

341-
print "};"
342-
print
343-
print "#define NUM_IMAGES (sizeof(images) / sizeof(images[0]))"
341+
print ("};")
342+
print()
343+
print ("#define NUM_IMAGES (sizeof(images) / sizeof(images[0]))")

Raspberry_Pi_On_Air_Sign/onair.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,18 @@ def paginate(pageToken): # ---------------------------------------------------
134134

135135
# Ustream broadcast query
136136
try: uOnline = req(uUrl)['results'] == 'live'
137-
except Exception, e: print "Error: {0} : {1}".format(type(e), e.args)
137+
except Exception as e: print ("Error: {0} : {1}").format(type(e), e.args)
138138

139139
# G+ hangout query
140140
try:
141141
pageToken = None
142142
while 1:
143143
pageToken = paginate(pageToken)
144144
if pageToken is None: break
145-
except Exception, e: print "Error: {0} : {1}".format(type(e), e.args)
145+
except Exception as e: print ("Error: {0} : {1}").format(type(e), e.args)
146146

147-
print 'G+ hangout: ' + ('online' if gOnline else 'offline')
148-
print 'Ustream : ' + ('online' if uOnline else 'offline')
147+
print ('G+ hangout: ') + ('online' if gOnline else 'offline')
148+
print ('Ustream : ') + ('online' if uOnline else 'offline')
149149
GPIO.output(pin, GPIO.HIGH if uOnline or gOnline else GPIO.LOW)
150150

151151
# Delay before next query
@@ -156,7 +156,7 @@ def paginate(pageToken): # ---------------------------------------------------
156156
i = bisect.bisect(mins, [m, 60]) - 1 # mins[] list index
157157
d = mins[i][1] - (n - startTime) # Time to next poll
158158
if d > 0:
159-
print 'Waiting ' + str(d) + ' seconds'
159+
print ('Waiting ') + str(d) + ' seconds'
160160
time.sleep(d)
161161
except:
162162
time.sleep(60)

0 commit comments

Comments
 (0)