[PORT COM] RS485 et pointeur null...
Bonjours,
Je galaire un maximum avec la librairie RXTX...
Mon but est de communiquer avec une carte RS485...
Lorsque je tape le code suivant getCommPort me retourne null...
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| public class test extends Thread
{
private CommPort port ;
private RXTXCommDriver portDriver ;
private InputStream in ;
private OutputStream out ;
/** Creates a new instance of BalancePrecia */
public test()
{
portDriver = new RXTXCommDriver() ;
portDriver.initialize() ;
port = portDriver.getCommPort("COM3", CommPortIdentifier.PORT_RS485) ;
try
{
in = port.getInputStream() ;
out = port.getOutputStream() ;
}
catch (IOException e)
{
System.err.println("communication, BalancePrecia," +
" construction : " + e) ;
}
}
} |
Merci de votre aide, floanne.