Hello @jeffmorris1956,
Your posted code did not seem to work for me and sharing my exploration.
I modified your code and used the Arduino code from my previous post to echo back data:
void setup()
{
size(1200,800);
myPort = new Serial(this, "COM7", 9600);
delay(1000); // This did the trick!
println("Ready!");
//myPort.bufferUntil('\n');
cp5 = new ControlP5(this);
createMessageBox();
}
void draw()
{
background(0);
if(myPort.available() > 0)
{
int val = myPort.read();
println("Rx: ", val);
}
}
Your events:
myPort.write(val01);
myPort.write(val02);
It only worked on my Arduino Mega 2560 R3 once I added the delay:
delay(1000); // This did the trick!
Related:
https://discourse.processing.org/t/processing-to-arduino-serial-library-example/11143
The correct servo part you can work on… lots of suggestions and resources out there for that.
:)