Markus Antoschak
2006-09-10 20:25:19 UTC
Dear users,
i've a problem to communicate with my serial port. I use the RXTX package
and it works fine with some Applets but it doesn't work in an ImageJ-Plugin.
I want to send a char 'q' to my ASURO-Robot (www.arexx.com). A red LED
should blink but it doesn't. Do i forget something?
Here is a snap of my code:
static CommPortIdentifier portID;
int b = 'q';
static SerialPort serialPort;
static OutputStream outputStream;
....
...
..
try {
portID = CommPortIdentifier.getPortIdentifier("COM1");
}catch (NoSuchPortException port){}
try {
serialPort = (SerialPort) portID.open("mein_programm",2000);
}catch (PortInUseException portuse){}
try {
outputStream = serialPort.getOutputStream();
}catch (IOException io){}
try {
serialPort.setSerialPortParams(2400, SerialPort.DATABITS_8,
SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
}catch (UnsupportedCommOperationException e){}
try {
outputStream.write(b);
}catch (IOException ou){}
serialPort.close();
Best regards :)
Markus
i've a problem to communicate with my serial port. I use the RXTX package
and it works fine with some Applets but it doesn't work in an ImageJ-Plugin.
I want to send a char 'q' to my ASURO-Robot (www.arexx.com). A red LED
should blink but it doesn't. Do i forget something?
Here is a snap of my code:
static CommPortIdentifier portID;
int b = 'q';
static SerialPort serialPort;
static OutputStream outputStream;
....
...
..
try {
portID = CommPortIdentifier.getPortIdentifier("COM1");
}catch (NoSuchPortException port){}
try {
serialPort = (SerialPort) portID.open("mein_programm",2000);
}catch (PortInUseException portuse){}
try {
outputStream = serialPort.getOutputStream();
}catch (IOException io){}
try {
serialPort.setSerialPortParams(2400, SerialPort.DATABITS_8,
SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
}catch (UnsupportedCommOperationException e){}
try {
outputStream.write(b);
}catch (IOException ou){}
serialPort.close();
Best regards :)
Markus