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.

times_square.jpg

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

SenseHat with case.jpg

The following components are used for this project:

Raspberry Pi 3

Sense Hat

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

CMD update.jpg

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

sudo pip feedparser.jpg

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.

open_python_editor.PNG

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.

feedparser.PNG

Type or copy into editor:

import feedparser

from sense_hat import SenseHat

Set Variables.

rss_path.PNG

sense = SenseHat()

d = feedparser.parse("http://rss.nytimes.com/services/xml/rss/nyt/World.xml")




Print Title Test.

feedparser.PNG
rss_path.PNG

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!

57d1ab9d4936d425cd000745.jpeg

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.