Intro: Times Square in Your Living Room! Turn Your Sense Hat LED Into a News Ticker.
Bring Times Square home with streaming news headlines straight from the New York Times.
In a few easy steps you can turn your Sense Hat into an RSS news feed!
This tutorial will feature one of the capabilities of the Sense Hat: A built in command that scrolls messages across the 8x8 LED screen.
Step 1: Gather Components
The following components are used for this project:
Sense Hat case New! See-through enclosure protects your LED screen without obstructing visibility.
Looking for a great introduction to Raspberry Pi? Try the Zagros Raspberry Pi 3 Starter Kit which has everything you need to begin discovering Raspberry Pi.
Step 2: Update and Upgrade
Make sure your system is updated and upgraded with the latest version by running the following commands in the Terminal. (Click the computer icon on the Raspberry Pi menu bar)
1.) Type this command and press enter.
sudo apt-get update
2.) Type this command and press enter.
sudo apt-get dist-upgrade
Step 3: Install Feedparser Module
Type into Terminal:
sudo pip install feedparser
You can check to make sure your feedparser module is installed by typing:
Step 4: Open Python Editor.
1.) Press Menu button.
2.) Navigate to Programming >> Python-3 (IDLE).
You have now opened the Python Shell.
3.) Click File.
4.) Click New File.
Step 5: Import Modules for Your Project.
Type or copy into editor:
from sense_hat import SenseHat
Step 6: Set Variables.
sense = SenseHat()
d = feedparser.parse("http://rss.nytimes.com/services/xml/rss/nyt/World.xml")
Step 7: Print Title Test.
Test your path by printing the RSS feed title to the Shell:
This should print NYT > World to the Shell.
If it doesn't, make sure the link is typed exactly as it is in the last step.
Step 8: Display Streaming News!
Loop through the latest New York Times World headlines:
for post in d.entries:
To run your program, press F5.
That was easy!
There are many RSS feeds available to you. You can display jokes, fun facts, weather, or create your own unique messages for your family and friends.