Problem with Port in ARDUINO/Processing

Hello, I am sending some data over serial from Processing to ARDUINO. When I try to open the serial Monitor of Arduino to read the data I get the message that my port is already being used...and this makes sense. I am using in both processing and ARDUINO COM4 when I have one platform on the other conflicts and does not work.It depends what I open first, then the other application does not work. Any advice? Thank you

Why not make the Processing application read and display the responses from the Arduino?

hi, thanks for the reply.. You mean just send the data back to processing from ARDUINO to confirm that they are clear?

You mean just send the data back to processing from ARDUINO to confirm that they are clear?


Hi, This was a good solution and it worked!!The thing is that I send a byte to ARDUINO which I know which byte is and then I confirmed and send back to Processing. My challenge now is to send 256 unknown bytes and confirm that arrived to ARDUINO and then send them back and print them in processing. My programming skills are not so good,so might post some pieces of code later on, but thanks for the nice solution!

I am sending to ARDUINO 9 red()values of 9 pixels and waiting for a ping back from ARDUINO in order to print my red values into processing…but nothing seems to happen. I tried to clean my code as much as possible and keep it simple. My sequence is: I send to ARDUINO from Processing ,I read in ARDUINO and write back to Processing…but nothing seems to happen.
Any suggestion will be appreciated.
thanks again for the help so far.

Processing Code:

//This code reads and prints the pixel values of a 9x9 matrix
import processing.serial.*;
Serial port;
int initval=0; //initial value that the matrix starts
int pixval; //pixel value each time
int col = 9; //number of the matrix columns

port = new Serial(this,Serial.list()[1], 9600);
PImage myImage;
myImage = loadImage(“jelly9x9.jpg”);
image (myImage, 0, 0, width, height);

for (pixval = initval; pixval < initval + 1*col; pixval = pixval+1) {
color a = myImage.pixels[pixval];

float r = red(a);
int intr = int(r);

if (port.available() > 0) {
int inByte =;


byte incomingByte;

void setup(){
void loop(){

if (Serial.available() > 0) {
incomingByte =;

I'd try blinking the pin 13 LED in the Arduino sketch, whenever it successfully read a byte. That way, you'd know when the Arduino received something, although the RX light should flash to tell you that. Similarly, the TX light should flash when the Arduino sends data.

The TX and RX light on duration is pretty short, and easy to miss, so making the onboard LED light up for longer makes it easier to see.


The variable intr is already an int. There is no reason to explicitly cast an int to an int.

thanks a lot for the advice!!!!It works indeed with the LED! At least I am sure that Arduino sends data back..want to print them neatly in processing though!!!will try this further...thanks again