# Quote board matrix display
# uses AdafruitIO to serve up a quote text feed and color feed
# random quotes are displayed, updates periodically to look for new quotes
# avoids repeating the same quote twice in a row

import time
import random
import board
import terminalio
from adafruit_matrixportal.matrixportal import MatrixPortal

# --- Display setup ---
matrixportal = MatrixPortal(status_neopixel=board.NEOPIXEL, debug=True)

# Create a new label with the color and text selected
matrixportal.add_text(
    text_font=terminalio.FONT,
    text_position=(0, (matrixportal.graphics.display.height // 2) - 1),
    scrolling=True,
)

# Static 'Connecting' Text
matrixportal.add_text(
    text_font=terminalio.FONT,
    text_position=(2, (matrixportal.graphics.display.height // 2) - 1),
)

QUOTES_FEED = "sign-quotes.signtext"
COLORS_FEED = "sign-quotes.signcolor"
SCROLL_DELAY = 0.02
UPDATE_DELAY = 600
Ejemplo n.º 2
0
# SPDX-FileCopyrightText: 2020 John Park for Adafruit Industries
#
# SPDX-License-Identifier: MIT

# Scoreboard matrix display
# uses AdafruitIO to set scores and team names for a scoreboard
# Perfect for cornhole, ping pong, and other games

import time
import board
import terminalio
from adafruit_matrixportal.matrixportal import MatrixPortal

# --- Display setup ---
matrixportal = MatrixPortal(status_neopixel=board.NEOPIXEL, debug=False)

RED_COLOR = 0xAA0000
BLUE_COLOR = 0x0000AA

# Red Score
matrixportal.add_text(
    text_font=terminalio.FONT,
    text_position=(4, int(matrixportal.graphics.display.height * 0.75) - 3),
    text_color=RED_COLOR,
    text_scale=2,
)

# Blue Score
matrixportal.add_text(
    text_font=terminalio.FONT,
    text_position=(36, int(matrixportal.graphics.display.height * 0.75) - 3),
Ejemplo n.º 3
0
    if index is not None:
        return messages[index]
    return "Unknown"


SENSOR_ID = 3085  # Poughkeepsie  # 30183  LA outdoor  / 37823  oregon  / 21441   NYC
SENSOR_REFRESH_PERIOD = 30  # seconds
DATA_SOURCE = "https://www.purpleair.com/json?show=" + str(SENSOR_ID)
SCROLL_DELAY = 0.02
DATA_LOCATION = ["results", 0, "PM2_5Value"]  # navigate the JSON response

# --- Display setup ---
matrixportal = MatrixPortal(
    status_neopixel=board.NEOPIXEL,
    debug=True,
    url=DATA_SOURCE,
    json_path=(DATA_LOCATION, DATA_LOCATION),
)

# Create a static label to show AQI
matrixportal.add_text(
    text_font=terminalio.FONT,
    text_position=(8, 7),
    text_transform=aqi_transform,
)

# Create a scrolling label to show level message
matrixportal.add_text(
    text_font=terminalio.FONT,
    text_position=(0, 23),
    scrolling=True,
Ejemplo n.º 4
0
EVENT_HOUR = 00
EVENT_MINUTE = 00

FRAME_DURATION = 2
FRAMES = (
    "DAYS",
    "HOURS",
    "MINUTES",
    "Until",
    "Christmas",
)

SYNCHRONIZE_CLOCK = True

# --- Display setup ---
matrixportal = MatrixPortal(status_neopixel=board.NEOPIXEL, debug=True)

current_frame = None

# Create a new label with the color and text selected
matrixportal.add_text(
    text_font="fonts/Arial-12.bdf",
    text_position=(4, (matrixportal.graphics.display.height // 2) - 1),
    text_color=0xFF0000,
)


def set_time_until(unit=None):
    event_time = time.struct_time((
        EVENT_YEAR,
        EVENT_MONTH,
Ejemplo n.º 5
0
except ImportError:
    print("WiFi secrets are kept in secrets.py, please add them there!")
    raise

TICKER = "GME"
# Set up where we'll be fetching data from
DATA_SOURCE = "https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol={}&apikey={}".format(
    TICKER, secrets["apiKey"])
DATA_LOCATION = ["Global Quote", "05. price"]

# the current working directory (where this file is)
cwd = ("/" + __file__).rsplit("/", 1)[0]

matrixportal = MatrixPortal(
    url=DATA_SOURCE,
    json_path=DATA_LOCATION,
    status_neopixel=board.NEOPIXEL,
    debug=False,
)

matrixportal.add_text(
    text_font=terminalio.FONT,
    text_position=(0, 5),
    text_color=0xAF1F5C,
)

matrixportal.add_text(
    text_font=terminalio.FONT,
    text_position=(22, 16),
    text_color=0x3D1F5C,
)
matrixportal.preload_font(b"$012345789")  # preload numbers
Ejemplo n.º 6
0
from random import randrange
import board
import terminalio
from adafruit_matrixportal.matrixportal import MatrixPortal

# --- Data Setup --- #
# Number of guides to fetch and display from the Adafruit Learning System
DISPLAY_NUM_GUIDES = 1
# Data source URL
DATA_SOURCE = ("https://learn.adafruit.com/api/guides/new.json?count=%d" %
               DISPLAY_NUM_GUIDES)
TITLE_DATA_LOCATION = ["guides"]

matrixportal = MatrixPortal(
    url=DATA_SOURCE,
    json_path=TITLE_DATA_LOCATION,
    status_neopixel=board.NEOPIXEL,
)

# --- Display Setup --- #

# Colors for guide name
colors = [0xFFA500, 0xFFFF00, 0x008000, 0x0000FF, 0x4B0082, 0xEE82EE]

# Delay for scrolling the text
SCROLL_DELAY = 0.03

FONT = "/IBMPlexMono-Medium-24_jep.bdf"

# Learn guide count (ID = 0)
matrixportal.add_text(
    print("WiFi secrets are kept in secrets.py, please add them there!")
    raise

print("Party Parrot Twitter Matrix")

#  import your bearer token
bear = secrets['bearer_token']

#  query URL for tweets. looking for hashtag partyparrot sent to a specific username
DATA_SOURCE = 'https://api.twitter.com/2/tweets/search/recent?query=#partyparrot to:blitzcitydiy'
#  json data path to get most recent tweet's ID number
DATA_LOCATION = ["meta", "newest_id"]

#  create MatrixPortal object to grab data/connect to internet
matrixportal = MatrixPortal(url=DATA_SOURCE,
                            json_path=DATA_LOCATION,
                            status_neopixel=board.NEOPIXEL)

#  create matrix display
matrix = Matrix(width=32, height=32)
display = matrix.display

group = displayio.Group()

#  load in party parrot bitmap
parrot_bit, parrot_pal = adafruit_imageload.load("/partyParrotsTweet.bmp",
                                                 bitmap=displayio.Bitmap,
                                                 palette=displayio.Palette)

parrot_grid = displayio.TileGrid(parrot_bit,
                                 pixel_shader=parrot_pal,
    if CURRENCY == "USD":
        return "$%d" % val
    if CURRENCY == "EUR":
        return "‎€%d" % val
    if CURRENCY == "GBP":
        return "£%d" % val
    return "%d" % val


# the current working directory (where this file is)
cwd = ("/" + __file__).rsplit("/", 1)[0]

matrixportal = MatrixPortal(
    url=DATA_SOURCE,
    json_path=DATA_LOCATION,
    status_neopixel=board.NEOPIXEL,
    default_bg=cwd + "/bitcoin_background.bmp",
    debug=False,
)

matrixportal.add_text(
    text_font=terminalio.FONT,
    text_position=(27, 16),
    text_color=0x3d1f5c,
    text_transform=text_transform,
)
matrixportal.preload_font(b"$012345789")  # preload numbers
matrixportal.preload_font((0x00A3, 0x20AC))  # preload gbp/euro symbol

while True:
    try:
Ejemplo n.º 9
0
    raise

# --- Constants --- #

# Board related variables
FONT = "/5x8.bdf"
SCROLL_SPEED = 0.04

# Request related variables
URL = secrets['aws-api-url']
HEADERS = {'x-api-key': secrets['x-api-key']}

# --- MatrixPortal --- #

matrixportal = MatrixPortal(status_neopixel=board.NEOPIXEL,
                            url=URL,
                            headers=HEADERS)

# --- (X,Y) related constants --- #

TEAM_ONE_X = 32
TEAM_ONE_SHADOW_X = TEAM_ONE_X + 1
TEAM_TWO_X = 49
TEAM_TWO_SHADOW_X = TEAM_TWO_X + 1

TOP_ROW_HEIGHT = int(matrixportal.graphics.display.height * 0.25) - 5
BOTTOM_ROW_HEIGHT = int(matrixportal.graphics.display.height * 0.75) - 4

# --- Text Fields --- #

# Team One Score Shadow
Ejemplo n.º 10
0
def text_transform(val):
    if CURRENCY == "USD":
        return "$%d" % val
    if CURRENCY == "EUR":
        return "‎€%d" % val
    if CURRENCY == "GBP":
        return "£%d" % val
    return "%d" % val


# the current working directory (where this file is)
cwd = ("/" + __file__).rsplit("/", 1)[0]

matrixportal = MatrixPortal(
    url=DATA_SOURCE,
    json_path=DATA_LOCATION,
    status_neopixel=board.NEOPIXEL,
)

matrixportal.add_text(
    text_font=terminalio.FONT,
    text_position=(16, 16),
    text_color=0xFFFFFF,
    text_transform=text_transform,
)
matrixportal.preload_font(b"$012345789")  # preload numbers
matrixportal.preload_font((0x00A3, 0x20AC))  # preload gbp/euro symbol

while True:
    try:
        value = matrixportal.fetch()
Ejemplo n.º 11
0
DATA3_LOCATION = ["l"]  #  Low price of the day
DATA4_LOCATION = ["pc"]  #  Prevoius Close
DATA5_LOCATION = ["d"]  #  Prevoius Close

# the current working directory (where this file is)
cwd = ("/" + __file__).rsplit("/", 1)[0]

FONT = "/fonts/IBMPlexMono-Medium-24_jep.bdf"
FONT2 = "/fonts/helvB12.bdf"
FONT3 = "/fonts/helvR10.bdf"
FONT4 = "/fonts/6x10.bdf"

#Get the JSON data
matrixportal = MatrixPortal(url=DATA_SOURCE,
                            json_path=(DATA1_LOCATION, DATA2_LOCATION,
                                       DATA3_LOCATION, DATA4_LOCATION,
                                       DATA5_LOCATION),
                            status_neopixel=board.NEOPIXEL,
                            debug=True)

#Get the JSON data
#Use this to use chain LED's width=128, height=32, change width (64x2=128) as you add more LED's
#matrixportal = MatrixPortal(
#    url=DATA_SOURCE, json_path=(DATA1_LOCATION, DATA2_LOCATION, DATA3_LOCATION, DATA4_LOCATION,DATA5_LOCATION), status_neopixel=board.NEOPIXEL,bit_depth=2, width=128, height=32, debug=True
#)


#Add info to the JSON Data
def text_Current(val):
    return STOCK1 + "  $%g" % val

Ejemplo n.º 12
0
from adafruit_matrixportal.matrixportal import MatrixPortal

try:
    from secrets import secrets
except ImportError:
    print("WiFi secrets are kept in secrets.py, please add them there!")
    raise
# You can display in 'GBP', 'EUR' or 'USD'
CURRENCY = "USD"
# the current working directory (where this file is)
cwd = ("/" + __file__).rsplit("/", 1)[0]
Stonks = ["GME", "BB", "AMC", "NOK"]

#matrixportal PRE-LOAD
matrixportal = MatrixPortal(default_bg=cwd + "/WSB_fire.bmp",
                            status_neopixel=board.NEOPIXEL,
                            debug=True)


def text_transform(val):
    if CURRENCY == "USD":
        return "$%d" % val
    if CURRENCY == "EUR":
        return "‎€%d" % val
    if CURRENCY == "GBP":
        return "£%d" % val
    return "%d" % val


#Text1 Price
matrixportal.add_text(
Ejemplo n.º 13
0
import time
import board
import terminalio
from adafruit_matrixportal.matrixportal import MatrixPortal
from secrets import secrets
import microcontroller

TEXT_COLOR = 0x202020
TIME_UPDATE_INTERVAL = 1 * 60 * 60
OPENWEATHER_API_URL = f"https://api.openweathermap.org/data/2.5/weather?q={secrets['zip']},{secrets.get('country','US')}&appid={secrets['openweather_api_key']}&units={secrets.get('units', 'imperial')}"
TEMP_PATH = ["main", "temp"]

matrixportal = MatrixPortal(
    status_neopixel=board.NEOPIXEL,
    bit_depth = 4
)

weather = None

def refresh_data():
    global weather
    temp = matrixportal.network.fetch_data(OPENWEATHER_API_URL, json_path=(TEMP_PATH))[0]
    weather = int(temp)
    matrixportal.get_local_time()

matrixportal.add_text(
    text_font=terminalio.FONT,
    text_position=(3, 9),
    text_color=TEXT_COLOR,
    text_scale=2,
)