I am using Processing to send data that I am receiving via Arduino using the serial port. The problem is that now I am not able to use the serial monitor of the Arduino IDE anymore! I am getting an error message that says "Port busy".
To me that makes sense, because the serial monitor tries to access the same port that's already established between Processing and the Arduino board. But I need to see the values that are being sent! Is there any way to accomplish this? I already find it weird that the Arduino IDE doesn't work without an Arduino board attached.
Could I have several Serial objects open - e.g. one between Arduino IDE and Processing, the other between Arduino IDE and Arduino?
Here's my code. It works.
// PROCESSING
import processing.serial.*;
void setup(){
size( 800, 400 );
//Open the serial port for communication with the Arduino
String portName = Serial.list()[3];
myPort = new Serial(this, portName, 9600);
}
void draw(){
myPort.write("stuff");
}
// ARDUINO
char val; // Data received from the serial port
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available()){
val = Serial.read(); // read it and store it in val
}
Serial.println(val);
delay(10); // Wait 10 milliseconds for next reading
}
I need to use Processing and Arduino together. Processing fetches cursor positions and sends them to Arduino. For debugging, I need some sort of monitor for when the data is already in the Arduino.
For debugging, I need some sort of monitor for when the data is already in the Arduino.
When you call your mates to arrange a get-together for beer, do you need for your wife to listen to their responses? Why can't you listen to their responses?
Processing is making the calls to send data (invites). Processing should, and can, listen to the responses.
blar1234:
I need to use Processing and Arduino together. Processing fetches cursor positions and sends them to Arduino. For debugging, I need some sort of monitor for when the data is already in the Arduino.
There has to be a way to display values.
This is a common requirement.
You need to add some code to your Processing program to display the data coming from the Arduino. That way everything is part of the Processing program and there is no need for the Serial Monitor.
Or you could use SoftSerial to communicate with Processing and the Serial monitor to display values from the Arduino. Or you could use an Arduino board with more than one serial interface built in.