Created
May 1, 2019 04:15
-
-
Save gallaugher/cd1706415c27a630dcaeb2ed10357453 to your computer and use it in GitHub Desktop.
PyPortal+Firebase Experiments
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
""" | |
Put this code on a properly configured PyPortal. You can buy one | |
from Adafruit: | |
https://www.adafruit.com/product/4116 | |
Special thanks to John for posting touch-screen code he used in his | |
PyPortal app launcher: | |
https://furcean.com/2019/03/21/pyportal-app-launcher/ | |
And John Park & the Adafruit crew for the PyPortal Weather Station | |
demo, which was helpful in understanding JSON parsing. | |
https://learn.adafruit.com/pyportal-weather-station/overview | |
""" | |
import time | |
import board | |
import json | |
import adafruit_touchscreen | |
from adafruit_pyportal import PyPortal | |
# from adafruit_button import Button | |
from adafruit_bitmap_font import bitmap_font | |
from adafruit_display_text.label import Label | |
DATA_SOURCE = "https://firestore.googleapis.com/v1beta1/projects/doorsign-3557c/databases/(default)/documents/elements/" # pylint: disable=line-too-long | |
pyportal = PyPortal(url=DATA_SOURCE, # pylint: disable=line-too-long | |
image_resize=(320, 240), | |
image_position=(0, 0), | |
image_url_path="https://gallaugher.com/wp-content/uploads/2019/04/adafruit_logo.png") | |
# above should work, but replace it with the line below, which should be the same image, and the PyPortal chokes. | |
# the image below is stored in Firebase Storage. | |
# image_url_path="https://firebasestorage.googleapis.com/v0/b/doorsign-3557c.appspot.com/o/adafruit_logo.png?alt=media&token=98f38b55-d738-4142-ae46-e98600fe9ef0") | |
data = pyportal.fetch() | |
while True: | |
time.sleep(1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment