Last active
September 7, 2022 20:58
-
-
Save vwillcox/c82fdf60bade293668d2d17abd9c5f09 to your computer and use it in GitHub Desktop.
Scroll the current people aboard the ISS on a Raspberry Pi Pico W With a Pimoroni Unicorn Pack Attached.
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
# Based on | |
# Scroller Demo | |
# Kevin McAleer May 2022 | |
# Additional code by Vincent Willcox September 2022 | |
import network | |
import secrets | |
import time | |
import urequests | |
from scroller import Scroller | |
from time import sleep | |
# create a scroller 0bject | |
scroll = Scroller() | |
# set the hue colour (0 is red etc) | |
hue = 0.8 | |
scroll.clear() | |
wlan = network.WLAN(network.STA_IF) | |
wlan.active(True) | |
wlan.connect(secrets.SSID, secrets.PASSWORD) | |
print(wlan.isconnected()) | |
while True or KeyboardInterrupt: | |
astronauts = urequests.get("http://api.open-notify.org/astros.json").json() | |
number = astronauts['number'] | |
for i in range(number): | |
message = astronauts['people'][i]['name'] | |
#message = "There are currently " + message + " people on the ISS" | |
for position in range(16, -len(message*(5+1)),-1): | |
scroll.show_message(message, position, hue) | |
sleep(0.01 ) | |
scroll.clear() |
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
SSID = "SSID" # Your SSID | |
PASSWORD = "PASSWORD" # Your Wifi Password |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You will need the rest of the code from Kevin's Git Hub
You will also need to create a secrets.py file with your WIFI SSID and WiFi Password:
SSID = "SSID"
PASSWORD = "PASSWORD"
See : https://github.com/kevinmcaleer/unicorn_scroller for more information