def colour_gauge_update(smile_count): print "Colour Gauge" display = BicolorMatrix8x8.BicolorMatrix8x8() display.begin() display.clear() #Change color using [BicolorMatrix8x8.RED, BicolorMatrix8x8.GREEN, BicolorMatrix8x8.YELLOW] if 0 < smile_count <= 6 or smile_count > 0: display.set_pixel(7, 7, BicolorMatrix8x8.RED) if 7 < smile_count <= 12 or smile_count > 7: display.set_pixel(7, 6, BicolorMatrix8x8.RED) if 13 < smile_count <= 18 or smile_count > 13: display.set_pixel(7, 5, BicolorMatrix8x8.YELLOW) if 19 < smile_count <= 24 or smile_count > 19: display.set_pixel(7, 4, BicolorMatrix8x8.YELLOW) if 25 < smile_count <= 30 or smile_count > 25: display.set_pixel(7, 3, BicolorMatrix8x8.YELLOW) if 31 < smile_count <= 36 or smile_count > 31: display.set_pixel(7, 2, BicolorMatrix8x8.GREEN) if 37 < smile_count <= 42 or smile_count > 37: display.set_pixel(7, 1, BicolorMatrix8x8.GREEN) if smile_count > 42: display.set_pixel(7, 0, BicolorMatrix8x8.GREEN) display.write_display()
def __init__(self): self.display = BicolorMatrix8x8.BicolorMatrix8x8() self.display.begin() self.shutDown() self.colors = [ BicolorMatrix8x8.RED, BicolorMatrix8x8.GREEN, BicolorMatrix8x8.YELLOW, BicolorMatrix8x8.OFF ]
def colour_gauge(smile_count, seconds_elapsed): print "Colour Gauge" display = BicolorMatrix8x8.BicolorMatrix8x8() display.begin() display.clear() display.set_image(display.create_blank_image()) display.write_display() image = Image.new('RGB', (8, 8)) draw = ImageDraw.Draw(image) display.clear() if 0 < smile_count <= 10 or smile_count > 0: x_coordinates_gauge = [ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7 ] y_cooordinates_gauge = [ 2, 3, 4, 5, 1, 6, 0, 7, 0, 7, 0, 7, 0, 7, 1, 6, 2, 3, 4, 5 ] for x, y in zip(x_coordinates_gauge, y_cooordinates_gauge): draw.point((x, y), fill=(0, 255, 0)) # time.sleep(1) if 10 < smile_count <= 20 or smile_count > 10: draw.line((6, 2, 6, 5), fill=(255, 0, 0)) # time.sleep(1) if 20 < smile_count <= 30 or smile_count > 20: draw.line((5, 1, 5, 6), fill=(255, 255, 0)) # time.sleep(1) if 30 < smile_count <= 40 or smile_count > 30: draw.line((4, 1, 4, 6), fill=(255, 255, 0)) # time.sleep(1) if 40 < smile_count <= 50 or smile_count > 40: draw.line((3, 1, 3, 6), fill=(255, 255, 0)) # time.sleep(1) if 50 < smile_count <= 60 or smile_count > 50: draw.line((2, 1, 2, 6), fill=(0, 255, 0)) # time.sleep(1) if 60 < smile_count <= 70 or smile_count > 60: draw.line((1, 2, 1, 5), fill=(0, 255, 0)) # time.sleep(5) display.set_image(image) display.write_display()
def smiling_face(color): display = BicolorMatrix8x8.BicolorMatrix8x8() display.begin() print "Smiley Face - Green" x_coordinates = [ 0, 0, 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 7, 7, 7 ] y_cooordinates = [ 2, 3, 4, 5, 1, 6, 0, 2, 5, 7, 0, 7, 0, 2, 5, 7, 0, 3, 4, 7, 1, 6, 2, 3, 4, 5 ] for x, y in zip(x_coordinates, y_cooordinates): display.set_pixel(x, y, color) display.write_display()
def straight_face(color): print "Straight face - Yellow" display = BicolorMatrix8x8.BicolorMatrix8x8() display.begin() display.clear() x_coordinates_straight = [ 0, 0, 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 4, 4, 5, 4, 4, 5, 6, 6, 7, 7, 7, 7 ] y_cooordinates_straight = [ 2, 3, 4, 5, 1, 6, 0, 2, 5, 7, 0, 7, 0, 2, 5, 7, 0, 3, 4, 7, 1, 6, 2, 3, 4, 5 ] for x, y in zip(x_coordinates_straight, y_cooordinates_straight): display.set_pixel(x, y, color) display.write_display()
def DisplayCounter(count): counter= count%8; # Alternatively, create a display with a specific I2C address and/or bus. display = BicolorMatrix8x8.BicolorMatrix8x8(address=0x70, busnum=1) # Initialize the display. Must be called once before using the display. display.begin() display.clear() # First create an 8x8 RGB color image. image = Image.new('RGB', (8, 8)) # Then create a draw instance. draw = ImageDraw.Draw(image) #draw.rectangle((0,0,7,7), outline =(255,0,0),fill =(255,255,0)) draw= DrawDigit(draw, counter &1 , 0) draw =DrawDigit(draw, (counter>>1) &1, 1) draw =DrawDigit(draw, (counter>>2) &1, 2) # Draw the image on the display buffer. display.set_image(image) # Draw the buffer to the display hardware. display.write_display() #time.sleep(0.5) return
def display_init(): # Create display instance on default I2C address (0x70) and bus number. display = BicolorMatrix8x8.BicolorMatrix8x8() display.begin() display.clear() # Smile image_smile= Image.new('RGB',(8,8)) draw_smile = ImageDraw.Draw(image_smile) draw_smile.line((0, 2, 0, 5), fill=(0, 255, 0)) draw_smile.line((1, 1, 1, 1), fill=(0, 255, 0)) draw_smile.line((1, 6, 1, 6), fill=(0, 255, 0)) draw_smile.line((2, 0, 5, 0), fill=(0, 255, 0)) draw_smile.line((2, 7, 5, 7), fill=(0, 255, 0)) draw_smile.line((7, 2, 7, 5), fill=(0, 255, 0)) draw_smile.line((2, 3, 2, 4), fill=(0, 255, 0)) draw_smile.line((3, 2, 3, 2), fill=(0, 255, 0)) draw_smile.line((3, 5, 3, 5), fill=(0, 255, 0)) draw_smile.line((5, 2, 5, 2), fill=(255, 255, 0)) draw_smile.line((5, 5, 5, 5), fill=(255, 255, 0)) # pote image_pote= Image.new('RGB',(8,8)) draw_pote = ImageDraw.Draw(image_pote) draw_pote.line((0, 2, 0, 5), fill=(0, 255, 0)) draw_pote.line((1, 1, 1, 1), fill=(0, 255, 0)) draw_pote.line((1, 6, 1, 6), fill=(0, 255, 0)) draw_pote.line((2, 0, 5, 0), fill=(0, 255, 0)) draw_pote.line((2, 7, 5, 7), fill=(0, 255, 0)) draw_pote.line((7, 2, 7, 5), fill=(0, 255, 0)) draw_pote.line((3, 3, 3, 4), fill=(0, 255, 0)) draw_pote.line((2, 2, 2, 2), fill=(0, 255, 0)) draw_pote.line((2, 5, 2, 5), fill=(0, 255, 0)) draw_pote.line((5, 2, 5, 2), fill=(255, 255, 0)) draw_pote.line((5, 5, 5, 5), fill=(255, 255, 0)) # froid image_froid= Image.new('RGB',(8,8)) draw_froid = ImageDraw.Draw(image_froid) draw_froid.line((0, 2, 0, 5), fill=(0, 255, 0)) draw_froid.line((1, 1, 1, 1), fill=(0, 255, 0)) draw_froid.line((1, 6, 1, 6), fill=(0, 255, 0)) draw_froid.line((2, 0, 5, 0), fill=(0, 255, 0)) draw_froid.line((2, 7, 5, 7), fill=(0, 255, 0)) draw_froid.line((7, 2, 7, 5), fill=(0, 255, 0)) draw_froid.line((2, 3, 2, 4), fill=(0, 255, 0)) draw_froid.line((2, 2, 2, 2), fill=(0, 255, 0)) draw_froid.line((2, 5, 2, 5), fill=(0, 255, 0)) draw_froid.line((5, 2, 5, 2), fill=(255, 255, 0)) draw_froid.line((5, 5, 5, 5), fill=(255, 255, 0)) # bof image_bof= Image.new('RGB',(8,8)) draw_bof = ImageDraw.Draw(image_bof) draw_bof.line((0, 2, 0, 5), fill=(0, 255, 0)) draw_bof.line((1, 1, 1, 1), fill=(0, 255, 0)) draw_bof.line((1, 6, 1, 6), fill=(0, 255, 0)) draw_bof.line((2, 0, 6, 0), fill=(0, 255, 0)) draw_bof.line((2, 7, 6, 7), fill=(0, 255, 0)) draw_bof.line((7, 2, 7, 5), fill=(0, 255, 0)) draw_bof.line((2, 3, 2, 4), fill=(0, 255, 0)) draw_bof.line((3, 2, 3, 3), fill=(0, 255, 0)) draw_bof.line((2, 5, 2, 5), fill=(0, 255, 0)) draw_bof.line((5, 2, 5, 2), fill=(0, 255, 0)) draw_bof.line((5, 5, 5, 5), fill=(0, 255, 0)) # grrrr image_grr= Image.new('RGB',(8,8)) draw_grr = ImageDraw.Draw(image_grr) draw_grr.line((0, 2, 0, 5), fill=(0, 255, 0)) draw_grr.line((1, 1, 1, 1), fill=(0, 255, 0)) draw_grr.line((1, 6, 1, 6), fill=(0, 255, 0)) draw_grr.line((2, 0, 6, 0), fill=(0, 255, 0)) draw_grr.line((2, 7, 6, 7), fill=(0, 255, 0)) draw_grr.line((7, 2, 7, 5), fill=(0, 255, 0)) draw_grr.line((2, 2, 2, 5), fill=(0, 255, 0)) draw_grr.line((3, 2, 3, 5), fill=(0, 255, 0)) draw_grr.line((5, 2, 5, 2), fill=(255, 0, 0)) draw_grr.line((5, 5, 5, 5), fill=(255, 0, 0)) # black image_black= Image.new('RGB',(8,8)) draw_black = ImageDraw.Draw(image_black)
def getWebcamStatus(): result = 0 f = open("data/webcamStatus", "r") ws = f.readline().strip() if ws == '1': result = 1 return result ##################################################################################### # Initialise displays matrix = BicolorMatrix8x8.BicolorMatrix8x8(address=MATRIX_ADDRESS, busnum=I2C_BUS) matrix.begin() matrix.set_brightness(BRIGHTNESS) alpha = AlphaNum4.AlphaNum4(address=ALPHA_ADDRESS, busnum=I2C_BUS) alpha.begin() alpha.set_brightness(BRIGHTNESS) # Scroll a message across the display current_alpha = 0 status = list() current_status = 0 try: while True: drawAlphaText(alpha, current_alpha)
# # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. import time from PIL import Image from PIL import ImageDraw from Adafruit_LED_Backpack import BicolorMatrix8x8 # Create display instance on default I2C address (0x70) and bus number. display = BicolorMatrix8x8.BicolorMatrix8x8() # Alternatively, create a display with a specific I2C address and/or bus. # display = Matrix8x8.Matrix8x8(address=0x74, busnum=1) # Initialize the display. Must be called once before using the display. display.begin() # Run through each color and pixel. # Iterate through all colors. for c in [ BicolorMatrix8x8.RED, BicolorMatrix8x8.GREEN, BicolorMatrix8x8.YELLOW ]: # Iterate through all positions x and y. for x in range(8): for y in range(8):
def setup_display(): display = BicolorMatrix8x8.BicolorMatrix8x8() display.begin() display.clear() display.write_display() return display
def __init__(self): self.display = BicolorMatrix8x8.BicolorMatrix8x8() self.frameIndex = 0 self.currMode = '' self.display.begin() self.display.clear()
def display_scroll(vTxt, txtColor, baseLineColor, scrollNonStop, letLastDataOnScreen): vTxt = vTxt.upper() # lower case char are converted in upper case # because not possible lower case char on a 3x5 matrix # Create display instance on default I2C address (0x70) and bus number. display = BicolorMatrix8x8.BicolorMatrix8x8() display.begin() display.clear() vCol = 7 # start on the sevens column (the right of the display) nCol = 1000 # max 1000 column so about 250 char nRow = 8 # 8x8 leds matrix vDisp = [[0] * nRow for k in range(nCol) ] # the array of 1000 columns and 8 rows filled with 0 # Prepare the display matrix for c in vTxt: # for each char in vTxtx for d in DIGIT_VALUES: # search the char if d[0] == c: # char found vStart = 2 # coding start at thirst char vStop = vStart + 3 # every value coded on 3 char # find the bits for each coded value while vStop <= len(d): i = int(d[vStart:vStop]) # codage du caractere if i & 1 <> 0: # bit0 vDisp[vCol][0] = txtColor if i & 2 <> 0: # bit1 vDisp[vCol][1] = txtColor if i & 4 <> 0: # bit2 vDisp[vCol][2] = txtColor if i & 8 <> 0: # bit 3 vDisp[vCol][3] = txtColor if i & 16 <> 0: # bit 4 vDisp[vCol][4] = txtColor if i & 32 <> 0: # bit 5 vDisp[vCol][5] = txtColor ## if i&64 <> 0: # bit 6 ## vDisp[vCol][6]=txtColor ## if i&128 <> 0: # bit 7 ## vDisp[vCol][7]=txtColor # Codage de la ligne de base vDisp[vCol][6] = baseLineColor vDisp[vCol][7] = baseLineColor # on prepare la valeur suivante vStart = vStop vStop = vStart + 3 vCol += 1 if letLastDataOnScreen: vRange = vCol - 7 else: # clear the screen when the scroll finished vRange = vCol + 1 if not scrollNonStop: for c in range(vRange): for d in range(c, c + 8): for l in range(nRow): # display a activer display.set_pixel(7 - l, d - c, vDisp[d][l]) display.write_display() time.sleep(0.15) else: while True: for c in range(vRange): for d in range(c, c + 8): for l in range(nRow): # display a activer display.set_pixel(7 - l, d - c, vDisp[d][l]) display.write_display() time.sleep(0.15)
#!/usr/bin/python3 """ Example of the game of life 8x8 LED matrix dispplay class """ from threading import Lock # from Adafruit_Python_LED_Backpack.Adafruit_LED_Backpack import BicolorMatrix8x8 from Adafruit_LED_Backpack import BicolorMatrix8x8 import led8x8life if __name__ == '__main__': LOCK = Lock() DISPLAY = BicolorMatrix8x8.BicolorMatrix8x8() DISPLAY.begin() LIFE = led8x8life.Led8x8Life(DISPLAY, LOCK) LIFE.reset() while True: LIFE.display()
def sound_alarm(self, turn_on): """ turn power to piexo on or off """ if turn_on: self.gpio.output(self.pin, GPIO.HIGH) else: self.gpio.output(self.pin, GPIO.LOW) def reset(self, ): """ turn power to piexo off """ self.gpio.output(self.pin, GPIO.LOW) CLOCK = ledclock.LedClock() CLOCK.run() DISPLAY = BicolorMatrix8x8.BicolorMatrix8x8(address=CONFIG.matrix8x8_addr) DISPLAY.begin() MATRIX = led8x8controller.Led8x8Controller(DISPLAY) MATRIX.run() ALARM = AlarmController(CONFIG.piezo_pin) ALARM.sound_alarm(False) class TimedEvents: """ timed event handler """ def __init__(self, day, night): """ initialize night,day and light status """ if night < day: raise "NIGHT < DAY"
def __init__(self): mp.Process.__init__(self) self.display = BicolorMatrix8x8.BicolorMatrix8x8() self.display.clear() self.display.write_display() time.sleep(0.1)
def main(config_file): print( '{0}\n\n{1}: Display Commute Time\n [data provided by Google Maps and 511.org]\n [https://developers.google.com/maps/]\n [http://www.511.org/developers/]\n' .format(time.strftime('%A, %d %b %Y, %H:%M:%S', time.localtime()), verstring)) ## # open the configuration file print('Reading Config file ' + config_file) config = ConfigParser.SafeConfigParser() try: config_info = config.read(config_file) if not config_info: print('ERROR: config file not found ("{0}")'.format(config_file)) sys.exit(1) except: print('ERROR: Problem with config file (missing, bad format, etc)') print(' (Config file "{0}")'.format(config_file)) print("{0}".format(sys.exc_info())) sys.exit(1) # get the config values try: USER_KEY = config.get('USER', 'USER_KEY') API_TOKEN = config.get('USER', 'API_TOKEN') if config.has_option('USER', 'DATA_FILE'): DATA_FILE = config.get('USER', 'DATA_FILE') if DATA_FILE: print('Commute Data will be saved to: {0}'.format(DATA_FILE)) else: DATA_FILE = [] STARTPOINT = config.get('COMMUTE', 'ORIGIN') ENDPOINT = config.get('COMMUTE', 'DESTINATION') ROADS = config.get('COMMUTE', 'ROADS') SEG_LIST = config.get('COMMUTE', 'SEG_LIST').split(',') EST_OTHER = int(config.get('COMMUTE', 'EST_OTHER')) UPDATE_INTERVAL = int(config.get('DISPLAY', 'UPDATE_INTERVAL')) COMMUTE_PIXEL = int(config.get('DISPLAY', 'COMMUTE_PIXEL')) except: print("ERROR: Unable to read from config file") print(" Unexpected error: {0}".format(sys.exc_info())) sys.exit(1) ## # initialize LED displays print('Initializing LED displays') # Create display instance with I2C address (eg 0x70). display = BicolorMatrix8x8.BicolorMatrix8x8(address=0x70) sevenseg = SevenSegment.SevenSegment(address=0x72) # Initialize the display(s). Must be called once before using the display. display.begin() display.clear() display.write_display() sevenseg.begin() sevenseg.clear() sevenseg.write_display() # turn on the colon to show that we are working... sevenseg.set_colon(True) sevenseg.write_display() # show startup animation startup_splash(display, sevenseg) ## Create 2D arrays for pixel values # array for traffic intensity pxArray = [[0 for y in range(8)] for x in range(8)] # array for traffic incidents (top line of display) tiArray = [0 for x in range(8)] # create image for "error message" errorImage = Image.new('RGB', (8, 8)) edraw = ImageDraw.Draw(errorImage) # Draw an X with two red lines: edraw.line((1, 1, 6, 6), fill=(255, 0, 0)) edraw.line((1, 6, 6, 1), fill=(255, 0, 0)) ## # main loop print('') retries = 0 # for retrying when errors are received update_count = 0 # for updating LED matrix display while retries < numRetries: try: # blink colon to show update in progress sevenseg.set_colon(False) sevenseg.write_display() print('Requesting traffic data from Google Maps... ({0})'.format( time.strftime('%A, %d %b %Y, %H:%M:%S', time.localtime()))) # Get current travel time from Google Maps rGGL = requests.get( 'https://maps.googleapis.com/maps/api/distancematrix/xml?units=imperial&origins={0}&destinations={1}&departure_time=now&key={2}' .format(STARTPOINT, ENDPOINT, USER_KEY)) # get the traffic incident info from 511 # r511 = requests.get('http://api.511.org/traffic/traffic_segments?api_key={0}&road={1}&limit=10000&format=xml'.format(API_TOKEN,ROADS)) if rGGL.status_code != 200: print('ERROR: Problem with Google API request') print('Response status code {0}'.format(rGGL.status_code)) retries += 1 continue # elif r511.status_code != 200: # print('ERROR: Problem with 511 API request') # print('Response status code {0}'.format(r511.status_code) ) # retries += 1 # # elif r511.content.find('Error') >= 0: # print('WARNING: 511 server returned an error ({0})\n'.format(retries) ) # print(r511.content) # retries += 1 # quit after trying a few times # time.sleep(1) # continue nowTime = time.localtime() # blink colon to show update in progress sevenseg.set_colon(True) sevenseg.write_display() # r.content contains the reply XML string # parse the XML into a tree try: root = ET.fromstring(rGGL.content) except: print('ERROR: XML parse error.') time.sleep(5) retries += 1 # quit after trying a few times continue # the xml tree contains routes between the destinations # arranged in rows of elements. Google returns the "best" route # first, so look for one row with one element rows = root.findall('row') if len(rows) > 1: print('WARNING {0} rows.'.format(len(rows))) if len(rows) == 0: print('ERROR: no routes found (0 rows)') retries += 1 # quit after trying a few times continue elements = rows[0].findall('element') if len(elements) > 1: print('WARNING {0} elements.'.format(len(elements))) if len(elements) == 0: print('ERROR: no routes found (0 elements)') retries += 1 # quit after trying a few times continue # get Travel Time # time values are in seconds durTraf = elements[0].find('duration_in_traffic') curTime = int(durTraf.find('value').text) print(' Current Travel Time with traffic: {0:.2f} min'.format( curTime / 60)) durTyp = elements[0].find('duration') typTime = int(durTyp.find('value').text) print(' Travel Time without traffic: {0:.2f} min'.format(typTime / 60)) # the xml tree contains "segments", i.e portions of roads. # traffic_segments = root.find('traffic_segments') # segments = traffic_segments.findall('traffic_segment') # if len(segments) == 0: # print('ERROR: no traffic segments found') # sys.exit(1) # # get traffic incidents # incidents = paths[route_index].findall('incidents') # incident_list = incidents[0].findall('incident') # if len(incident_list) > 0: # print(' Traffic incidents:') # for incident in incident_list: # print(' {0}'.format(incident.text) ) # else: # print(' No traffic incidents reported at this time') incident_list = [] # estimate arrival time # google provides end-to-end estimate, so no need for other factors estDriveTime = time.localtime(time.mktime(nowTime) + (curTime)) # units of seconds print(' Estimated time of Arrival: {0}'.format( time.strftime('%A, %d %b %Y, %H:%M', estDriveTime))) # show arrival time estimate on 7-segment display #print(time.strftime('%H%M',estDriveTime)) sevenseg.print_number_str(time.strftime('%H%M', estDriveTime)) sevenseg.write_display() # write results to file if desired if DATA_FILE: f = open(DATA_FILE, 'a') f.write('{0},{1},{2}\n'.format(time.mktime(nowTime), curTime, typTime)) f.close() ## Update LED display # update at startup, and then at a multiple of data updates if update_count == 0 or update_count > UPDATE_INTERVAL: #print('Update LED matrix') pxArray, tiArray = update_matrix(display, pxArray, curTime / 60, typTime / 60, incident_list, tiArray, COMMUTE_PIXEL) # reset update count update_count = 1 # update the LED matrix display less often than the 7-segment display update_count += 1 # wait for the "whole minute" between updates # v1.5: update time display every minute. Update LED matrix less often. time.sleep(60 - time.localtime()[5]) print('') # reset the retries counter; if we got here it was a successful loop retries = 0 # Use Ctrl-C to quit manually, or for Supervisord to kill process except KeyboardInterrupt: print('\n** Program Stopped (INT signal) ** ' + time.strftime("%Y/%m/%d-%H:%M:%S", time.localtime())) streamEndTime = time.time( ) # time of stream end, unix epoch seconds #print("sys.exec_info(): {0}".format(sys.exc_info()) ) break print('') except requests.exceptions.ConnectionError: print('\n** Connection Error ** ' + time.strftime("%Y/%m/%d-%H:%M:%S", time.localtime())) print(" Will Retry Connection...") time.sleep(10) retries += 1 # quit after trying a few times except: print('\n** Other Exception ** ' + time.strftime("%Y/%m/%d-%H:%M:%S", time.localtime())) print("Unexpected error: {0}".format(sys.exc_info())) if retries > 0: print('\nCommuteClock: Exit after {0} retries\n'.format(retries)) # show error on display display.set_image(errorImage) display.write_display() else: display.clear() display.write_display() sevenseg.clear() sevenseg.write_display() print('CommuteClock: Program Exit\n')