I am trying to use Java to detect signals from the serial port sent from an IR circuit. When the IR circuit detects an obstacle, it gives an output of 0 volts and otherwise the output is 5 volts. Can I read these voltage differences directly on the PC using Java. Do I need to have a PIC or some other micro controller integrated in the circuit?

Recommended Answers

All 4 Replies

I think you will need some kind of driver that will connect to java to get data from a serial port.

A steady 5v or 0v signal is not a standard RS-232 signal. First, you need a specialized driver capable of detecting that the voltage change is valid and not just a transient glitch (not uncommon), and then passing the appropriate information to the user-space application (java in this case). Honestly, this would be a lot easier in C, and may be simpler to create a JNI to the C code that will let your java application to detect these state changes. Have fun, and good luck!

yeah...i installed the driver....i had tested this with a hyper terminal and i did get readings...so shouldn't java be able to detect it as well...

yeah...i installed the driver....i had tested this with a hyper terminal and i did get readings...so shouldn't java be able to detect it as well...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.