Hello ladies and gentlemen;
I read and receive datas to and from twos differents serial usb ports.
Is it possible to do this on the same serial port.?
I tried but if i read data on the same serial.port, Processing tell me port busy.
In the setup my ports are managed like that
teensyport = new Serial(this,ports[2],115200); // si port connecté
//*************** WITHOUT TEENSY connected
DueSerialNativeUSBport101 = new Serial(this, Serial.list()[3], 115200);
// Read bytes into a buffer until you get a linefeed (ASCII 10):
DueSerialNativeUSBport101.bufferUntil('\n');
I read datas from an arduino with serial event
void serialEvent(Serial DueSerialNativeUSBport101) { // receive 2 datas splited with , and the last is send with println
// read the serial buffer:
String myString = DueSerialNativeUSBport101.readStringUntil('\n');
// if you got any bytes other than the linefeed:
myString = trim(myString);
// split the string at the commas
// and convert the sections into integers:
int values[] = int(split(myString, ','));
if (values.length > 0) {// v1 de 0 a 4000
int v1; int v2; int v3; int v4; int v5; int v6;
v1 = (int) map (values[0], 0, 4000, 0, 400);
v2 = (int) map (values[0], 0, 4000, 0, 400);
v3 = (int) map (values[0], 0, 4000, 0, 400);
v4 = (int) map (values[0], 0, 4000, 0, 400);
v5 = (int) map (values[0], 0, 4000, 0, 400);
v6 = (int) map (values[0], 0, 4000, 0, 400);
println (" v1 " + v1 ); println (" v1 " + v1 ); println (" v1 " + v1 ); println (" v1 " + v1 ); print (mouseY); print (" v1 "); println (v1);
}
I send data to the arduino like that <28643,32469,36099,34103,31316,30462,0,0,0,0,10,3,-3,0,0,0,0,0,0,1,1,0,1,1,1>
Thanks for helping!