开发者

How to detect signals at the serial COM1 port?

I have a infrared device (both transmitter and receiver). I've connected the receiver to the serial COM port and I send IR signals using the transmitter.

I'd like to monitor theese signals and whenever there is no signal, invoke another thread (sms sending code).

If I check the signals on hiperterminal, I get some unreadable values.

What should I look for as a NO CARRIER value to see if there is no data being recieved so I execute the second thread?

e.g

if(signals!=null)
{
    //do nothin
} 
else
{
    //t开发者_JAVA技巧hread2();
}


First of all, you should read The Java comm API documentation.

Also, look at this code example.

We'd need more information as to help you with the exact implementation details of your IR reciever.


Head over to rxtx.org for a free serial port library for Java under Windows, Linux or OSX. All the details and sample code can be found in this WikiBook.

The section on events, like getting notifications on control signal changes, is here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜