def flash(): scrollphat.set_pixels(lambda x, y: 1, True) time.sleep(0.1) scrollphat.clear() time.sleep(0.1)
def update_matrix(self): matrix = self.matrix_updater.update() scrollphat.set_pixels(lambda x, y: matrix[y][x], True)
def millis(): return int(round(time.time() * 1000)) def set_checker(offset): n = offset for y in range(5): for x in range(11): scrollphat.set_pixel(x,y,n % 2 == 0) n += 1 scrollphat.update() while True: try: scrollphat.set_pixels(lambda x, y: 1, auto_update=True) time.sleep(0.5) scrollphat.set_pixels(lambda x, y: y % 2 == 0, auto_update=True) time.sleep(0.5) scrollphat.set_pixels(lambda x, y: x % 2 == 0, auto_update=True) time.sleep(0.5) set_checker(0) time.sleep(0.5) set_checker(1) time.sleep(0.5) except KeyboardInterrupt: scrollphat.clear() sys.exit(-1)
#!/usr/bin/env python # simple binary clock # bcd for hours, minutes and seconds # chart for time past the hour (one light per whole ten minutes) import sys import time import scrollphat scrollphat.set_brightness(100) scrollphat.set_pixels(lambda x, y: (x + y) % 9, True)
if value <= col: scrollphat.set_pixel(col, row, False) else: scrollphat.set_pixel(col, row, True) scrollphat.update() stravatimer = 0 screentimer = 0 screen = 0 scrollphat.clear() #clear the display # Sleep for 10 seconds to give the wifi connection time to connect while showing loading pattern for i in range(0, 10): scrollphat.set_pixels(lambda x, y: x <= i, True) scrollphat.update() time.sleep(1) # wait 1 second scrollphat.set_pixels(lambda x, y: (x + y) % 2, True) #set chequer pattern while Strava is loading bargraph = getstravabargraph() # Get an initial load from Strava print("Running...") while True: #Loop this bit forever try: time.sleep(tickduration) if screen == 0: # show the number of days left until race scrollphat.write_string("%.0f" %
def loop_iteration(self, step): scrollphat.set_pixels(lambda x, y: True, True) self.sleep_interval() scrollphat.clear()
def update_matrix(self, matrix): scrollphat.set_pixels(lambda x, y: matrix[y][x], True)