display_tweet.append(text) if display_tweet: item = display_tweet.pop() textLCD.setBacklight(True) print item row1 = item[:20] row2 = item[20:40] print("Writing to first row....") textLCD.setDisplayString(0, row1) print("Writing to second row....") textLCD.setDisplayString(1, row2) sleep(2) print("Turn on cursor....") textLCD.setCursor(True) sleep(2) print("Turn on cursor blink....") textLCD.setCursor(False) textLCD.setCursorBlink(True) sleep(2) print("No Tweets") textLCD.setBacklight(False) textLCD.setCursorBlink(True) textLCD.setDisplayString(0, "") textLCD.setDisplayString(1, "") if len(display_tweet) > 100: break
sleep(2) print("Writing to second row....") textLCD.setDisplayString(1, "Row 2") sleep(2) print("Adjusting contrast up....") textLCD.setContrast(255) sleep(2) print("Adjusting contrast down....") textLCD.setContrast(110) sleep(2) print("Turn on cursor....") textLCD.setCursor(True) sleep(2) print("Turn on cursor blink....") textLCD.setCursor(False) textLCD.setCursorBlink(True) sleep(2) print("Clear the screen...") textLCD.setCursorBlink(False) textLCD.setDisplayString(0, "") textLCD.setDisplayString(1, "") sleep(2) except PhidgetException as e: print("Phidget Exception %i: %s" % (e.code, e.details)) print("Exiting....")