Hello @all,
I’m working on new installation and I need to receive the weight value from a digital balance.
I’ve tried with the serial monitor of arduino and it`s work perfectly but when I try to use with V4 anything happen.
With the serial monitor I simply send the message READ with CR and LF and I receive the string value.
Serial myPort; // Create object from Serial class
int lf = 10; // Linefeed in ASCII
int val; // Data received from the serial port
char[] arrays;
String inString; // Input string from serial port
String myString = null;
OscP5 oscP5;
NetAddress myRemoteLocation;
void setup()
{
frameRate(10);
size(10, 10);
// I know that the first port in the serial list on my mac
// is always my FTDI adaptor, so I open Serial.list()[0].
// On Windows machines, this generally opens COM1.
// Open whatever port is the one you’re using.
String portName = Serial.list()[0];
myPort = new Serial(this, portName, 9600); //myPort.buffer(18);
oscP5 = new OscP5(this, 12000);
myRemoteLocation = new NetAddress(“127.0.0.1”, 9999);
}
while (myPort.available() > 0) {
myString = myPort.readStringUntil(lf);
if (myString != null) {
OscMessage myMessage = new OscMessage("/test");
myMessage.add(myString); /* add an int to the osc message */
oscP5.send(myMessage, myRemoteLocation);
println(myString);
}
}
}