Click to See Complete Forum and Search --> : parallel and serial access in python


plutoazul
10-26-2001, 09:45 AM
I have search the net and the python documention and I have not found much to help me access the ports in python. I QBasic I just used OUT and INP. How do I do his in Python? I am using Slackware Linux.

Miguel

jemfinch
10-26-2001, 12:53 PM
"the ports"? Do you mean stdin/stdout/stderr? That's sys.stdin/stdout/stderr.

Jeremy

kmj
10-26-2001, 02:14 PM
No, he's talking about serial port and parallel port access, I think.

jemfinch
10-26-2001, 03:48 PM
A serial port is just a regular device file in Linux. Open /dev/ttyS0 and write
to it and read from it like a normal file.

Jeremy

kmj
10-26-2001, 04:23 PM
yeah, I did read somewhere that there is not yet any cross-platform way to access them in python yet.

jemfinch
10-27-2001, 04:43 AM
Originally posted by kmj:
yeah, I did read somewhere that there is not yet any cross-platform way to access them in python yet.

I don't think there's a cross-platform way to access them in any language
:)

Jeremy

Stuka
10-29-2001, 12:55 PM
Actually, jemfinch, there is a Java Communications package (javax.comm) that is working on being a cross platform serial/parallel port access method for Java. Naturally, this depends on the low-level code being written, but there are at least 2 OS's supported now (Win32 and Solaris), with a Linux port in progress as of the readme file I have. Libraries COULD be written in any language I'm sure - I wonder if any Perl hackers have done this (in my experience, they tend to be the most prolific spouters of code ;)).

plutoazul
10-30-2001, 09:27 AM
Thanks for the replies but no one has answered my question. But another search in goole turned up the perfect link I did not see before. The link contains a webpage with a python module--that does exactly what I need. And there is a version for Windows-winioport (http://www.geocities.com/dinceraydin/python/indexeng.html)ioport (http://www.hare.demon.co.uk/ioport/ioport.html)

Miguel

Aragorn
10-31-2001, 04:51 AM
Well I've gotta question related to the same. I have never programmed anything to write to a serial port or parallel port, what do I need to learn to do so? Why would I want to for any other reason besides printing out something(which I will need to learn how to do). Are there any good tutorials or anything that could get me going on coding for these such things?

Aragorn
Admin of GetLinuxOnline.Com

plutoazul
10-31-2001, 09:39 AM
Well, I am rather new to programming myself but I could answer some of your questions.
I was writing a program to read and write from the parallel port to control a robot. Specifically its two motors and take in input from four switch bump sensors mounted front, back, left and right. I have read of others using the parallel and serial ports to control other things as well. I am sure the applications are endless. I am also looking into USB. If I decide to go deeper and add more sensors. USB would be the easiest way to expand as I can connect many more devices i.e. senors. I do not know if I want to go any further.

The web sites I mention in my previous post has a lot of cool info on using the parallel and serial ports and it also has links to sites with more info. You could start
there (http://www.geocities.com/dinceraydin/python/indexeng.html). I have been checking out this si (http://www.lvr.com/) site specifically. A lot of info on parallel, serial, USB and more.

That should help you get started. Let me know if it helps.

Miguel

Stuka
10-31-2001, 11:14 AM
Well, here at work we sell LED wallboards that are controlled (most often at least) via the serial port. That's what forced me to learn serial port control under Win32...as our apps HAVE to be able to run on MS platforms. As for learning, hmmm....well, it really is application specific (at least for the serial port) - our wallboards have a protocol that defines their communication, while modem control is another thing entirely, etc.