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
serialPort.write(somethingASCII)
reads the variable on the Arduino.
val = Serial.read();
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() {
myPort.write(val);
val++;
if(val > 50)
val = 0;
}
and here is my arduino code
int val;
void setup()
{
Serial.begin(9600);
}
void loop()
{
if (Serial.available()) { // If data is available to read,
val = Serial.read(); // read it and store it in val
}
Serial.println(val);
}
I get an port "COM8" already in use
"COM8" is what my arduino is useing
any ideas of what im doing worng?
thanks!!!