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.

Microcontroller Programming » "connection refused" ledarray2

August 12, 2009
by Farmerjoecoledge
Farmerjoecoledge's Avatar

This is for you ledarray2 owners. What do you do when this happens to you? I had python-listener.py running a bash script and nc localhost 6667 to send the text to the array.Worked well. Then I ran the scrolling python script that can send the text without nc and it's shanghyed the port i mean complete and mercyless take over. I've tryed everything i know of including uninstalling and reinstalling nc to try to get it back, but to no avail. I've had the connection refused before but nothing but a reset fixed it.I would uninstall python but py-listener needs it to run. So help, tell me what you do.

August 12, 2009
by hevans
(NerdKits Staff)

hevans's Avatar

Hi Farmerjoecoledge,

Let's step back a little and figure out what is actually going on here. So you say you had it all working fine with the script that uses nc and localhost. This means you were running python-listener.py, it was connecting to your NerdKit via the serialport /dev/ttyUSB/, and also accepting socket connections from nc on port 6667.

Your new script, if I am not mistaken is using python only to send characters over the serial port down to the NerdKit. So why is this new script trying to open a connection at all? Where is the input coming from in your new system? Is it trying to connect to python-listener, or is it the /dev/ttyUSB/ serial port that it can't find? I think we need to know a little more before we can sort out the issue, and explaining the system will also help you understand it a bit better.

Have you tried restarting your computer, that always helps those "connection refused" issues.

Humberto

August 13, 2009
by Farmerjoecoledge
Farmerjoecoledge's Avatar

Hi, Good to see you on the forum.

Yeah, the python script is one that i got from a previous post, when it's running, in the same shell i type HELLO WORLD and there it goes across the array. So that would be what i thought was the /dev/ttyUSB/ in the script. It's this script that kaboshed python-listener.py

Python-listener needs(uses) netcat (nc) to open 6667, you can add another .py script to the same shell but that's another thing. So now after starting the listener, I open another shell type nc localhost 6667 and you know the rest.(echo GOODSTUFF | nc localhost 6667, never did anything in case you were going to mention that.) That's what's going on, i ran a python scroll script, works ok but only scrolls once. I want my array to be alive. I haven't mentioned this yet but there's a bash script that runs with nc that's exactly what i was looking for, and now my, bash bashz | nc localhost 6667, is "connection refused". Why 6667 why not 50001 anyway? Doesn't matter, so i hope this explains things (kabosh) a little better.

August 13, 2009
by Farmerjoecoledge
Farmerjoecoledge's Avatar

I've just discovered that the python script http://www.nerdkits.com/forum/thread/144/ half way down the page does pretty much the same as the bash, just takes longer to write it and copy it in. The bash script canibalizes one letter at a time which is kinda neat with just a few words like 20 letters with spaces will run as long as you want, just lengthen the spaces. It's just a shame nc localhost 6667 won't connect.

And now that i have your attention, i'm not having any luck with getting the rss live feed going, i'm obviously missing something easy like it says. Some things are just crazy, when they think their spelling it out for you and and the process doesn't work.(That reminds me of some of the code on this forum.) Anyway i'll keep working at it, i know, it's right in front of my nose.

August 17, 2009
by Farmerjoecoledge
Farmerjoecoledge's Avatar

Update: I got the listener to work again, had to? reinstall everything, lots of fun. Works now again which is good.

If anybody read the last part above don't even try it unless you like spinning your tires. Well at least i know how to do it now. Everything from the client to the download to the code for the feed, just one thing, the font.h file does not contain small letters, therefore it's impossible to send a feed. Why? because they just do not work for a five row array.

All is not lost, after slautering kubuntu by trying to open a .bin file i found Mepis this is the friendlyist distro out there.

August 18, 2009
by wayward
wayward's Avatar

hey,

if you want to convert all lowercase letters to uppercase before sending out to the LCD, do this:

bash bash2z | tr a-z A-Z | nc localhost 6667

In other words, just insert "tr a-z A-Z" halfway down the pipe between the process that is generating text for nc, and nc itself. It is also possible to transform any other incoming character in a similar vein; type "man tr" for more info.

August 19, 2009
by Farmerjoecoledge
Farmerjoecoledge's Avatar

There is a linux god, you be the man. Forgot to thank you for the bash2z works good. Lots of good things happening, why their happening is completely unknown at this point. I got the listener running opened another window tried a python, urlgrabber, wget, and squidclient with script and the, tr a-z A-Z | nc localhost 3128 and 6667 all would get the same running shell with nothing going across the display.(3128 is squidclient's port) I thought it was your code. So i gave up and just to get the array running something i started the listener again enter bash bash2z | nc localhost 6667 which would have ran the text that i entered. PUT DOWN SOME WORDS/// pressed enter and i've got something. It's hard to make out what it's saying with my array messed up but it's not what i entered and it's not being canableized. There it just finished, looks like it worked! that must have been one of the downloaded url files. Well there it goes again can make out some of it, stange these /// are showing up with ramdom letters inside, wild makes a wave. So if i figure out how this came about i'll be still be amazed. Haven't quite got a handle on what the code is for a stream yet. Seems all these need to be read from a downloaded file. Keeps me goin'. Hey, Zoran, thanks again.

Post a Reply

Please log in to post a reply.

Did you know that signed numbers need to be sign-extended when chaging variable sizes? Learn more...