2

I am talking about components that can be externally attached to a computer system via some port or other means, not about any of the component that is part of or peripheral of computer itself.

Actually, working on a college project for controlling traffic lights and boom barrier at railway crossing. I've got knowledge in Java but I do not know how can I get the traffic lights and boom barrier working on events in a Swing based application?
One thing is I can create a electronic circuit which can read the small output voltages at computer ports such as a USB port and used them as a trigger for controlling the devices. But how can I generate that small voltages using Java application?

Is JavaPOS can be the solution? or something else?

Any ideas? Suggestions? Articles? Samples?

Asif
  • 4,980
  • 8
  • 38
  • 53

4 Answers4

0

I think your looking at this the wrong way. Most lights are them selves computer controlled. The lights are running on a computer system. If your project is to write this start to end, then you need to write a loaded to the light controller that does many things, one controls light color and direction, also allow connections via an out side computer. This connection could be USB, Ethernet ext. Now write a program facilitating connecting to the lights and pass commands to the light controller.

Dwayne B
  • 107
  • 1
  • 13
0

By Socket Programming,We can Make Integration with Java To Hardware Like[Sensors,Printers....,],Java Provided Build-in Class Called Socket Class,Server Socket Server Class,...,.

Step-1: Initially We Create Socket Class Object,Within the object,we Need To Pass Parameter Hardware IP,In Order To Communicate With Java.

Step-2: After Integration,Send data In Byte Stream.

Step-3: Perform What Operation You Want.

0

Have you considered communicating with these external devices by sending digital signals to a serial port using Java? It's then a simple matter of either using those digital signals directly, or using an Analog-to-digital converter to get a voltage of desirable magnitude.

Same for input from the serial port. The RXTX library can help you do this (communicate with the serial port).

On the other hand, if you have access to MATLAB, then this sort of stuff is a piece of cake. Take a look at the Data Acquisition Toolbox and Instrument Control Toolbox.

eternaln00b
  • 1,043
  • 9
  • 18
  • Yeah you get it right. but I am not talking either about continuous signals. A set of two or three types of triggering signals for two or three serial/parallel ports will be sufficient. Such as I had fixed one USB port for boom barrier, it will require two different signals - one for UP and 2 for DOWN. . .similarly on other USB port - One for RED, two for ORANGE and three for GREEN. Also, i am specific about OS that is Windows. – Asif Mar 16 '12 at 21:08
  • I do not even write a `Hello World` in MATLAB, but if it is simple than I'll try to learn it for getting my work done. Can I integrate MATLAB with Java? – Asif Mar 16 '12 at 21:11
  • Yes, you can integrate MATLAB and Java very easily: http://www.mathworks.com/help/techdoc/matlab_external/f44062.html – eternaln00b Mar 16 '12 at 21:19
0

I'd work backwards from the external device. Answer this 1st: What's the easiest way to communicate with it? If you say USB, ok, use usb. Then ask, what's the easiest way to interface with USB. Then build in whatever language you find to be easiest this USB interface. Finally, call from your Java swing application to this USB-wrapping application... it could be that simple invoke the app using something like ProcessBuilder.

In other words, I think it might be a mistake to solve the problem of interfacing to something like this device with Java, unless it's easy to do so directly.

sethcall
  • 2,837
  • 1
  • 19
  • 22
  • If I say I am specific for Windows, than what would be the supportive _build in whatever language_ be? Could you provide some content about this part too/ – Asif Mar 16 '12 at 21:03