Beta of Python powered Iot device for displaying quotes from https://www.adafruit.com/quotes
code sample…
import time
import board
from adafruit_pyportal import PyPortal
from adafruit_bitmap_font import bitmap_font
from adafruit_display_text.text_area import TextArea
# Set up where we’ll be fetching data from
DATA_SOURCE = “https://www.adafruit.com/api/quotes.php”
QUOTE_LOCATION = [0, ‘text’]
AUTHOR_LOCATION = [0, ‘author’]
cwd = __file__.rsplit(‘/’, 1)[0]
pyportal = PyPortal(url=DATA_SOURCE,
json_path=(QUOTE_LOCATION, AUTHOR_LOCATION),
status_neopixel=board.NEOPIXEL,
default_bg=cwd+”/quote_background.bmp”,
text_font=”/fonts/Arial-ItalicMT-17.bdf”,
text_position=((20, 40), # quote location
(5, 190)), # author location
text_color=(0xFFFFFF, # quote text color
0x8080FF), # author text color
text_wrap=(35, # characters to wrap for quote
0), # no wrap for author
text_maxlen=(180, 30) # max text size for quote & author
)
while True:
try:
value = pyportal.fetch()
print(“Response is”, value)
except RuntimeError as e:
print(“Some error occured, retrying! -“, e)
time.sleep(5)
Visit the Adafruit shop online – http://www.adafruit.com
—————————————–
LIVE CHAT IS HERE! http://adafru.it/discord
Adafruit on Instagram: https://www.instagram.com/adafruit
Subscribe to Adafruit on YouTube: http://adafru.it/subscribe
Join our weekly Show & Tell on G+ Hangouts On Air: http://adafru.it/showtell
New tutorials on the Adafruit Learning System: http://learn.adafruit.com/
—————————————–
Related Post:
- How many people are in space? Python-powered IoT tells you @adafruit #space #astronauts #adafruit
- Star it! And it updates live … A Python-powered IoT device using CircuitPython @adafruit @github
- GoT IoT device … #ForTheThrone @adafruit #adafruit #gameofthrones
- All the Internet of Things — Episode 4 — Adafruit IO: An IoT Service for Everyone @digikey #adafruit
- Making an Internet of Things scale with PyPortal @adafruit #adafruit #iot #scale
- eink, circuitpython, IoT (JSON display on #eink with feather m4 and #ESP32 @adafruit #adafruit
- Azure IoT Hub device SDK for Python
- Bitcoin mining with 15 lines of python code | Python Bitcoin Tutorial
- Bitcoin mining with 15 lines of python code (HINDI) | Python Bitcoin mining
- OMG!! MITT HYBRID-LAG FÖR 2 MILJONER COINS!! FIFA 19 Ultimate Team på Svenska