Times Square in Your Living Room! Turn Your Sense Hat LED Into a News Ticker.
by ZRob314 in Circuits > Raspberry Pi
2449 Views, 8 Favorites, 0 Comments
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.
Gather Components
The following components are used for this project:
Sense Hat case New! See-through enclosure protects your LED screen without obstructing visibility.
HDMI Cable
Monitor
Keyboard
Mouse
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.
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
Install Feedparser Module
Type into Terminal:
sudo pip install feedparser
You can check to make sure your feedparser module is installed by typing:
pip list
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.
Import Modules for Your Project.
Type or copy into editor:
import feedparser
from sense_hat import SenseHat
Set Variables.
sense = SenseHat()
d = feedparser.parse("http://rss.nytimes.com/services/xml/rss/nyt/World.xml")
Print Title Test.
Test your path by printing the RSS feed title to the Shell:
print d.feed.title
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.
Display Streaming News!
Loop through the latest New York Times World headlines:
for post in d.entries:
print post.title
sense.show_message(post.title)
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.