NeuronRobotics / nrjavaserial

A Java Serial Port system. This is a fork of the RXTX project that uses in jar loading of the native code.
Other
344 stars 143 forks source link

example program does not run #159

Closed Reissner closed 4 years ago

Reissner commented 4 years ago

I think the example from the readme shall compile. For example the for loop misses blanks to compile.

    for (String s : NRSerialPort.getAvailableSerialPorts()) {
        System.out.println("Availible port: "+s);
        //port=s;
    }

but there are other issues. Maybe a class and a main method around would be better.

madhephaestus commented 4 years ago

the example from the readme is for running in a groovy script to test. If you want it in a java class you do need to add a class encapsulation and a main method.

Reissner commented 4 years ago

ah i see... sorry..

i found other point: char b = (char)ins.read() i had to insert the cast.