We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Dear friends,
I tried to read a simple serial data from arduino through processing.
Following is arduino code.
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.print("wise");
delay(1000);
}
It is working and I am getting " wise" on serial monitor(COM6) of arduino continueously.
Following is my processing code.
import processing.serial.*;
int portIndex = 0;
Serial myPort;
void setup() {
println(Serial.list());
myPort = new Serial(this, Serial.list()[portIndex], 9600);
}
void draw() {
print(myPort.available());
while (myPort.available() > 0) {
int inByte = myPort.read();
println(inByte);
}
print("hellow");
}
When I use port index =0; I am getting 0 value for myPort.available() function and "0hellow" is printed continuously in console are of processing.
When I use port index =4;as per ports list displayed in console window as per setup statements ( COM1 , COM 3, COM4, COM5,COM6), Nothing is printed and I am getting following message.
"Error opening serial port COM6: COM busy" along with ports list
"COM1 COM3 COM4 COM5 COM6"
Can you give me any suggestion please ?
K.Sitarama Rao,
Electronic Engineer and hobbyist
Comments
If you have the COM monitor utility open in Arduino, I believe that Processing will show it as busy.
Thanks for immediate reply.
Now my program is working.
K.Sitarama Rao.