File tree Expand file tree Collapse file tree 1 file changed +19
-22
lines changed
Expand file tree Collapse file tree 1 file changed +19
-22
lines changed Original file line number Diff line number Diff line change @@ -326,28 +326,25 @@ Travis build LED indicator
326326Use LEDs to indicate the status of a Travis build. A green light means the
327327tests are passing, a red light means the build is broken::
328328
329- from travispy import TravisPy
330- from gpiozero import LED
331- from time import sleep
332- from signal import pause
333-
334- def build_passed(repo='RPi-Distro/python-gpiozero', delay=3600):
335- t = TravisPy()
336- r = t.repo(repo)
337- while True:
338- yield r.last_build_state == 'passed'
339- sleep(delay) # Sleep an hour before hitting travis again
340-
341- def invert(values):
342- for value in values:
343- yield not value
344-
345- red = LED(12)
346- green = LED(16)
347-
348- red.source = invert(green.values)
349- green.source = build_passed()
350- pause()
329+ from travispy import TravisPy
330+ from gpiozero import LED
331+ from gpiozero.tools import negated
332+ from time import sleep
333+ from signal import pause
334+
335+ def build_passed(repo='RPi-Distro/python-gpiozero', delay=3600):
336+ t = TravisPy()
337+ r = t.repo(repo)
338+ while True:
339+ yield r.last_build_state == 'passed'
340+ sleep(delay) # Sleep an hour before hitting travis again
341+
342+ red = LED(12)
343+ green = LED(16)
344+
345+ red.source = negated(green.values)
346+ green.source = build_passed()
347+ pause()
351348
352349
353350Note this recipe requires travispy. Install with ``sudo pip3 install travispy ``.
You can’t perform that action at this time.
0 commit comments