NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Support Forum » feed-reader.py

April 22, 2011
by ta27544
ta27544's Avatar

Having trouble running the feed reader script it says it's having trouble connecting. I am not sure which port i should use and how to find it??

#feed-reader.py is meant as to be an RSS headline reader for the NerdKits LED array.
#To be used in conjuction with serial-comm.py
#suggested useage: % python feed-reader.py | python serial-comm.py

#set the feed_url variable for the feed you want ot read.
#feed_url = "http://sports.espn.go.com/espn/rss/mlb/news"
#feed_url = "http://www.cnbc.com/id/19746125/device/rss/rss.xml"
#feed_url = "http://twitter.com/statuses/user_timeline/19753668.rss"
#feed_url = "http://search.twitter.com/search.rss?q=+nerdkit+OR+nerdkits"
feed_url = "http://sports.espn.go.com/espn/rss/mlb/news"

sys.stdout.flush()
HOST = 'localhost'    # The remote host
PORT = 80           # The same port as used by the server
April 23, 2011
by Ralphxyz
Ralphxyz's Avatar

Hi ta27644, [quote]"I am not sure which port i should use and how to find it??"[/quote]

Do you have a web server running? localhost and port 80 are usually referencing a web server.

I never got as far as the feed-reader.py so I can not be more helpful.

Ralph

April 23, 2011
by ta27544
ta27544's Avatar

No i just changed it to port 80, the port is defaulted to 7777 in the script but I am unsure how to point it to a rss feed.

April 24, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

Hi ta37544,

feed_reader.py is doing two separate things as part of its control flow, and I think that is what is confusing you. The first thing it does is connect to serial_comm.py presumably running on the same machine to ask it how many messages it currently has in its buffer. After that (if feed_reader.py wishes to send more lines), it connects to feed_url and pulls the feed. I think you are probably getting the connection error because serial_comm.py isn't running.

Humberto

April 26, 2011
by ta27544
ta27544's Avatar

okay update .......I ran serial_comm.py first and this is what happens

Info: Waitign for Request
Connected by ('127.0.0.1', 50031)
Reporting  0
Info: Waitign for Request
Connected by ('127.0.0.1', 50033)
Reporting  0
Info: Waitign for Request
Connected by ('127.0.0.1', 50035)
Reporting  0
Info: Waitign for Request
Connected by ('127.0.0.1', 50038)
Reporting  0
Info: Waitign for Request
Connected by ('127.0.0.1', 50040)
Reporting  0
Info: Waitign for Request
Connected by ('127.0.0.1', 50042)
Reporting  0
Info: Waitign for Request
Connected by ('127.0.0.1', 50044)
Reporting  0
Info: Waitign for Request
Connected by ('127.0.0.1', 50046)
Reporting  0
Info: Waitign for Request

Next in a new tab of terminal I run feed-reader.py and this is what happens

A FEW CLOUDS AND 69 F AT SAN DIEGO/LINDBERGH, CA       
Reader: Info Resp 0

A FEW CLOUDS AND 69 F AT SAN DIEGO/LINDBERGH, CA       
Reader: Info Resp 0

A FEW CLOUDS AND 69 F AT SAN DIEGO/LINDBERGH, CA       
Reader: Info Resp 0

A FEW CLOUDS AND 69 F AT SAN DIEGO/LINDBERGH, CA       
Reader: Info Resp 0

A FEW CLOUDS AND 67 F AT SAN DIEGO/LINDBERGH, CA       
Reader: Info Resp 0

A FEW CLOUDS AND 69 F AT SAN DIEGO/LINDBERGH, CA       
Reader: Info Resp 0

A FEW CLOUDS AND 69 F AT SAN DIEGO/LINDBERGH, CA       
Reader: Info Resp 0

A FEW CLOUDS AND 69 F AT SAN DIEGO/LINDBERGH, CA       
Reader: Info Resp 0

A FEW CLOUDS AND 69 F AT SAN DIEGO/LINDBERGH, CA

So i am almost there its just not scrolling on the display....by the way when i run these scripts the chip is in run mode and the usb is still plugged in....what do think the problem could be??

April 27, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

Hi ta27544,

Well it looks like you have the feedreader part working. Did you go through the LED Array Guide in its entirety before attempting to make feedreader.py work? Does the LED Array work if you load the test programs, or if you attempt to just send data to it over minicom?

Humberto

April 27, 2011
by ta27544
ta27544's Avatar

Yes the test programs work fine

May 03, 2011
by ta27544
ta27544's Avatar

Is there anything I need to change i the serial-comm.py or feed reader.py file ?

May 03, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

Hi ta27544,

There shouldn't be anything you need to change. Unless you want it to do something different than what it already does.

Remember serial_comm.py takes its info over standard input. Are you piping the output of feedreader.py to serial_comm.py.

python feedreader.py | python serial_comm.py

Humberto

Post a Reply

Please log in to post a reply.

Did you know that you can make a capacitive proximity sensor with some aluminum foil and paperclips? Learn more...