无法在FreePIE中连接到正确的COM端口
我正在尝试在FreePIE(自由可编程输入模拟器)中运行一段代码,这个软件可以识别传感器或额外的硬件,让它们作为输入在你的电脑上使用。
我想运行的代码是用Python写的:
def update():
global yaw
global roll
global pitch
yaw = ahrsImu.yaw
roll = ahrsImu.roll
pitch = ahrsImu.pitch
vireioSMT.yaw = yaw - cyaw
vireioSMT.roll = roll - croll
vireioSMT.pitch = pitch - cpitch
diagnostics.watch(yaw-cyaw)
diagnostics.watch(roll-croll)
diagnostics.watch(pitch-cpitch)
if starting:
cyaw = 0
croll = 0
cpitch = 0
ahrsImu.update += update
center = keyboard.getPressed(Key.Z)
if center:
cyaw = yaw
croll = roll
cpitch = pitch
当我尝试运行时,出现了这个错误:

在这个软件里没有串口配置,COM3实际上并不存在,也没有任何东西连接到它,只有我的Arduino在COM6上,这才是运行这段代码的正确端口,但我无法让它连接上。
我尝试在if语句的开头添加了这一段代码:
port = SerialPort("COM6", 115200)
port.Open()
但是没有任何变化,问题依旧。
我该如何解决这个问题呢?
1 个回答
1
问题在于这段代码使用了一个叫“vireioSMT”的类,这个类是一个可以在FreePIE中使用的插件,大家可以在这里找到它:https://github.com/Baristan6/VireioSMT
如果把这个.dll文件添加到FreePIE中,这个错误就不会再出现了,代码会正常运行。