|
#1
|
|||
|
|||
|
IO
I am trying to build an ROV with an old mainboard running puppy linux as a OS. I want to use the Parallel port and game port for I/O I am currently programing in Java and I am having trouble finding a good way to read specific lines and pulsing specific lines. Does anyone know a good way or do I need to program in C/C++?
|
|
#3
|
|||
|
|||
|
Re: IO
That looks like it will work. I saw it earlier, but didn't look much. Thanks. Now I just need a way to work with the joystick. I can find pleanty of drivers that will let me read from the port, but I haven't come across anything that will let me send signals yet.
|
|
#4
|
|||
|
|||
|
Re: IO
Write to the 15 pin game port for the joystick? Even in the days of MS-DOS bit banging that was a pain. I'll Google around for MIDI interfaces to see whats out there. You may end up with a C/C++ wrapper for the MIDI port tweeks then making JNI calls for the joystick.
Can you use a serial stream that would come from a MIDI, or are you really looking for the bits to do IO that way? |
|
#5
|
|||
|
|||
|
Re: IO
I know with ASM it is not difficult. However, learning ASM is a real pain. There are no nice peak/poke functions anymore. I was hoping I could use the port as a kind of analog send or at least a 5V source for some sensors. However, if it is not possible I can use outboard power. I just thought it would help.
|
|
#6
|
||||
|
||||
|
Re: IO
I did manage to find a joystick library for C a little while ago called libjsw. If you can't find anything else, you could use a C wrapper for this library. Basically, it uses structures for each joystick, pretty much just like the objects in java, so if you can find someone who's good enough with C to break it down, you could rewrite it in java without TOO much complication.
And I like your premise. I've got 5 old (and I mean OLD) laptops sitting around that I've been thinking about repurposing in just this way. If Puppy Linux proves to be too slow (can't imagine it would be that bad), and you need something more time-critical, might I suggest MINIX? It's one of the ORIGINAL Unix operating branches, and has been designed to be tiny. Just food for thought. If you're not adverse to learning C, this project would probably be quite a bit easier for you. The libjsw library is written in C natively, and there are two functions in <asm/io.h> called inb() and outb() which can access any port on the computer using the hex address. The parallel port is generally 0x378 and 0x379 for write and read, respectively, I believe. There's a good tutorial for C control of the parallel port here. I have managed to run a small motor from a transistor amplifier directly from the parallel port using this method. Good luck, sounds like fun! And let us know what you learn along the way, I'm going to see if I can convince our team to let me run our summer swerve drive project on Linux. |
|
#7
|
|||
|
|||
|
Re: IO
I am not adverse to learning C. I know a little bit, and know several languages based on C, so syntax is basically what I need to learn. I didn't want to use C, though, because I am a better Java programer. Also, I wanted the end program to be as platform independent as possible. The more I think about it, I think I will just use external power.
I used a flash drive to store and run the OS. That way, it can be banged around and moved without having to worry about moving disks. I think Puppy should be fine. It doesn't have a high overhead and I know it will run Java. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|