You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My project is to read the data from a scale (Rhino Brand), however first you must send a command to request the data. and this was the step I was missing.
I share my code in case anyone needs it:
`SerialPort s = null;
try {
s = new SerialPort("/dev/ttyUSB0");
} catch (NoSuchPortException e) {
System.err.println("Oh no! That port doesn't exist!");
} catch (NotASerialPortException e) {
System.err.println("Oh no! That's not a serial port!");
}
OutputStream os = s.getOutputStream();
// Send Letter P or number 80 en hexidecimal
os.write("P".getBytes());
InputStream is = s.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is));
System.out.println(br.readLine());`
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hi, could you upload a complete example of how to read data?
All reactions