Arduino计划:
void setup() {
Serial.begin(9600);
}
int i;
void loop() {
for(i=30;i<=35;i++)
{
char a=i;
Serial.println(a);
delay(1000);
}
}
Blender python脚本:
import bge
import serial
ser=serial.Serial()
ser.baudrate=9600
ser.port=2
ser.timeout=1
ser.open()
scena=bge.logic.getCurrentScene()
cont=bge.logic.getCurrentController()
main_arm=cont.owner
sens=cont.sensors['mySensor']
if sens.positive:
u=ord(ser.read())
main_arm.channels['root'].location=[0,u,0]
main_arm.updata()
ERROR:
Traceback (most recent call last):
File ”Text“ ,line7.in(module)
File ”c:\Programe Files\Blender Foundation\Blender \ 2.69 \ python \ lib \ serial \ seriawin32.py“ line59 in open
raise SerialException(”could not open port %s %s“ (self.portstr.ctypes.WinError()))
serial.serialutil.SerialException:could not open port COM3[Errno5]
如何更正此错误?