variable from Processing to Arduino Serial port already in use?

I'm trying to send a variable from Processing to Arduino I have been splicing code from a few examples to make a simple test but I get an error that says port is ready in use.

is the basics just
serialPort = new Serial(bla,"myArduinoSerialPort", bla); ?

sends something in processing to Arduino as ascii


reads the variable on the Arduino.

 val =;

here is my processing code

import processing.serial.*;

Serial myPort;  
int val =0;        

void setup()
  size(175, 175);
  myPort = new Serial(this,"COM8", 9600);//COM8 is my Arduino

void draw() {
  if(val > 50)
   val = 0;

and here is my arduino code

int val;
void setup()

void loop()
 if (Serial.available()) { // If data is available to read,
     val =; // read it and store it in val

I get an port "COM8" already in use
"COM8" is what my arduino is useing

any ideas of what im doing worng?

I get an port "COM8" already in use
"COM8" is what my arduino is useing

Then close whatever application is using the port. Do you have the Serial Monitor open, too?

Any breakthrough yet? I am facing the same problem as well.


I had the same problem. I tried reloading over the original Arduino 1.0.1 folder as well as creating a new directory and having a second copy. Neither of these worked and I kept getting the message that COM8 was already in use.

In the end I checked which Arduino board was selected. Some how the IDE had lost its original setting of ATmega1280 and had defaulted to the first board on the Tools/Board menu. Resetting the board to ATmega1280 fixed the problem.

Hope this helps someone