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.

Project Help and Ideas » Using Python To Send Current Time to LED Array

February 18, 2013
by SirHobbes3
SirHobbes3's Avatar

Hi everyone, yes I'm back. Anyways, I have gotten the Led Array to where I can send messages to it with Python in the Ubuntu Linux Terminal and have them scroll, simple stuff. I then figured out a command in the Python Interpreter which allows me to show the current time.

import time;

localtime = time.asctime( time.localtime(time.time()) )
print "Local current time :", localtime

What I now need is a way to send that over the serial port and have the LEDs display that, and so far I've had no luck.

February 18, 2013
by Ralphxyz
Ralphxyz's Avatar

Hi SirHobbes3, nice to hear from you again.

So lets start with your code.

I kinda confused you say:

I have gotten the Led Array to where I can send messages to it with Python in the Ubuntu Linux Terminal and have them scroll, simple stuff.

and then :

What I now need is a way to send that over the serial port and have the LEDs display that,

You have successfully sent messages to the LED_Array but then just trying to send the local time breaks everything??

Ralph

February 21, 2013
by SirHobbes3
SirHobbes3's Avatar

Sorry, I'll try and make this less confusing. So what I'm trying to do is write a code that will allow me to send the time to the Led Array. Right now all i am able to do is send simple messages. I showed the command in python that allows me to get the time, but I am stumped as how to take that and send it to the Array.

February 21, 2013
by Ralphxyz
Ralphxyz's Avatar

Have you googled "python serial write?

Possible something like:

ser.write(localtime)

This assumes you have the serial port initialized of course.

Ralph

March 10, 2013
by SirHobbes3
SirHobbes3's Avatar

Ok, so while im still stumped on what I tried to do, i did go through the guide and get the python program you guys have working via linux. But i looked through the python program and im kinda confused on what it exactly it does in the code. A little help?

March 10, 2013
by Ralphxyz
Ralphxyz's Avatar

i did go through the guide and get the python program you guys have working via linux

Help us out here and show the code that you are having problems with or at least tell us the the name of the program and the area where you are having problems.

Ralph

March 11, 2013
by SirHobbes3
SirHobbes3's Avatar

Ok, sorry Ralph. I'm trying to better understand what the "python-listener" program does, because as of right now, I've looked at it and I'm confused.

Post a Reply

Please log in to post a reply.

Did you know that interrupts can be used to trigger pieces of code when events happen? Learn more...