我试图让我的arduino与处理程序进行通信。每次我这样做我都会收到此错误:
"Error opening serial port /dev/tty.usbmodem1441: Port busy"
。我的arduino正在使用相同的端口。
这是我的处理代码:
import processing.serial.*;
Serial myPort;
String val;
void setup()
{
String portName = Serial.list()[5];
myPort = new Serial(this, portName, 9600);
}
void draw()
{
if ( myPort.available() > 0) {
val = myPort.readStringUntil('\n');
}
println(val);
}
我是从https://learn.sparkfun.com/tutorials/connecting-arduino-to-processing得到的,但我没有做任何改变。
答案 0 :(得分:3)
如果您打开Arduino串行监视器,尝试使用Processing连接到串行线路将产生冲突,从而导致该错误。只需关闭串行监视器,然后再次尝试启动草图。 (也可以点击AREF附近的重置按钮重置Arduino)
答案 1 :(得分:0)
You cant use same port for two diffrent purpose at a same time.
check if that is the case. If thats not the case then try restarting arduino and pc both.
also make sure you are connected to the right port.
ls -l /dev/tty.* should return all connected dvices if you are in unix system
if you are in window, may be its under device mager(its been long time i used window)
答案 2 :(得分:0)
只需关闭Arduino中的“串行监视器”,一切都会正常运行