Skip to content

Instantly share code, notes, and snippets.

@ericskiff ericskiff/b57paper.py
Last active Aug 17, 2017

Embed
What would you like to do?
Simple bus status monitor for Raspberry Pi with Adafruit RePaper hat
## 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
You can’t perform that action at this time.