Last active
August 17, 2017 15:44
-
-
Save ericskiff/ac9a6e0a5de5191c437c7e9ab67fd20d to your computer and use it in GitHub Desktop.
Simple bus status monitor for Raspberry Pi with Adafruit RePaper hat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## BEFORE RUNNING: | |
## sudo apt-get install python3 python-pip | |
## sudo pip install bustime | |
## ALSO: Substitute your favorite bus stop below on line 24 by stop ID and bus line. | |
BUSTIME_API_KEY = "INSERT_API_KEY_HERE" | |
from papirus import PapirusTextPos | |
from bustime import StopMonitor | |
import threading | |
tpos = PapirusTextPos(False) | |
tpos.Clear() | |
clearCount = 0 | |
def PrintIt(): | |
# We want this to run indefintely, we set a timer at the top of the function to run it again in 10 sec | |
threading.Timer(10.0, PrintIt).start() | |
global clearCount | |
if clearCount == 10: | |
tpos.Clear() | |
clearCount = 0 | |
tpos.RemoveText(Id="Start") | |
tpos.AddText(str(StopMonitor(BUSTIME_API_KEY, '307696', 'b57', 3)), 10, 10, 15, Id="Start" ) | |
tpos.WriteAll(True) | |
clearCount += 1; | |
PrintIt() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment