Has the COM port changed? It is not always the first one in the array.
Try the code here and change COM port as required:
I always have this in my code to verify:
// List all the available serial ports:
printArray(Serial.list());
On my PC:
It may not be that simple but it is a starting point.
Simplify your code when testing to isolate issues.
I did not have your hardware and reduced it to test what I could:
Receive:
import processing.serial.*;
Serial myPort; // Create object from Serial class
String val; // Data received from the serial port
boolean SerialAvailable = false;
void setup() {
size(400, 250);
try {
String portName = Serial.list()[2]; //change the 0 to a 1 or 2 etc. to match your port
myPort = new Serial(this, portName, 9600);
myPort.bufferUntil('\n');
SerialAvailable = true;
println("Arduino found");
}
catch(Exception e) {
println("Arduino not found");
SerialAvailable = false;
}
}
void draw() {
CheckSerialCom();
}
void CheckSerialCom() {
if (SerialAvailable) {
SerialCom();
}
}
void SerialCom() {
// If data is available,
if ( myPort.available() > 0) {
val = myPort.readStringUntil('\n'); // read it and store it in val
if (val != null) {
val = trim(val); // removes whitespace + \r + \n
println(val);
}
}
}
Send:
int i;
void setup() {
Serial.begin(9600);
while (!Serial) {
delay(10);
}
}
void loop() {
// Get the currently touched pads
Serial.print(millis());
Serial.print(",");
Serial.print(i++);
Serial.println();
delay(100);
}
The above worked when selecting the correct COM port.
It did not find the COM port once time and I did a power reset unplugging USB (and plugging in).
Operating system?
Version of Processing in different systems?
Arduino IDE? Should not impact communication unless monitor is running.
:)
