极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 17593|回复: 3

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

[复制链接]
发表于 2013-11-20 17:52:21 | 显示全部楼层 |阅读模式
以下是我的程序,我的端口没有占用,但是编译的时候一直会出现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()[0], 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);

}
回复

使用道具 举报

发表于 2013-11-21 16:16:34 | 显示全部楼层
port = new Serial(this, Serial.list()[0], 9600);  
这个时侯端口已打开了
然后你又用了
port = new Serial(this, "COM17", 9600);
当然提示端口被占用了。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-11-28 20:01:12 | 显示全部楼层
jeffliu 发表于 2013-11-21 16:16
port = new Serial(this, Serial.list()[0], 9600);  
这个时侯端口已打开了
然后你又用了

那要实现功能要怎么改呢,求教
回复 支持 反对

使用道具 举报

发表于 2013-11-30 20:41:07 | 显示全部楼层
不二的文艺 发表于 2013-11-28 20:01
那要实现功能要怎么改呢,求教

晕,把后面那个port = new Serial(this, "COM17", 9600);注释掉就好了呀。如果你确定端口是COM17,那么就把前面那个port = new Serial(this, Serial.list()[0], 9600); 注释掉。这两行代码只能有一行有效。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 需要先绑定手机号

Archiver|联系我们|极客工坊

GMT+8, 2024-3-29 21:39 , Processed in 0.039087 second(s), 18 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表