Hello, does anyone knows if processing is able to communicate with two arduinos simultaneously? At the moment I don’t have two arduino to test the code but I’m trying to write it to progress with my work in the while.
import processing.serial.*;
Serial portDriver;
Serial portSampler;
public void setup()
{
size(470, 350, JAVA2D);
portDriver = new Serial(this,Serial.list()[0],1000000);
portSampler = new Serial(this,Serial.list()[1],1000000);
portSampler.bufferUntil('\n');
}
public void draw()
{
background(230);
}
void serialEvent(Serial port)
{
String inString = port.readStringUntil('\n');
if (inString == null) { return; }
// do stuff
}
So; there is an arduino which just receive commands and do stuff with motors, and communicates with processing through portDriver object.
The other arduino communicates through portSampler and receives, simultaneously, another command, and start sending strings to processing. You can see that since bufferUntil is called only for that one.
So one way is only out. The other is in-out.
Will such things ever work?
Thanks