不二的文艺 发表于 2013-11-20 17:52:21

求解~procesing 一直提示port com 17:port busy

以下是我的程序,我的端口没有占用,但是编译的时候一直会出现port busy这是为什么呢。


import processing.serial.*;

Serial port;



void setup() {

size(256, 150);



println("Available serial ports:");

println(Serial.list());



// Uses the first port in this list (number 0).Change this to

// select the port corresponding to your Arduino board.The last

// parameter (e.g. 9600) is the speed of the communication.It

// has to correspond to the value passed to Serial.begin() in your

// Arduino sketch.

port = new Serial(this, Serial.list(), 9600);



// If you know the name of the port used by the Arduino board, you

// can specify it directly like this.

port = new Serial(this, "COM17", 9600);

}



void draw() {

// draw a gradient from black to white

for (int i = 0; i < 256; i++) {

stroke(i,0,0);

line(i, 0, i, 150);

}



// write the current X-position of the mouse to the serial port as

// a single byte

port.write(mouseX);

}

jeffliu 发表于 2013-11-21 16:16:34

port = new Serial(this, Serial.list(), 9600);
这个时侯端口已打开了
然后你又用了
port = new Serial(this, "COM17", 9600);
当然提示端口被占用了。

不二的文艺 发表于 2013-11-28 20:01:12

jeffliu 发表于 2013-11-21 16:16 static/image/common/back.gif
port = new Serial(this, Serial.list(), 9600);
这个时侯端口已打开了
然后你又用了


那要实现功能要怎么改呢,求教

jeffliu 发表于 2013-11-30 20:41:07

不二的文艺 发表于 2013-11-28 20:01 static/image/common/back.gif
那要实现功能要怎么改呢,求教

晕,把后面那个port = new Serial(this, "COM17", 9600);注释掉就好了呀。如果你确定端口是COM17,那么就把前面那个port = new Serial(this, Serial.list(), 9600); 注释掉。这两行代码只能有一行有效。
页: [1]
查看完整版本: 求解~procesing 一直提示port com 17:port busy