根据PWM说明,可以通过Linux文件驱动MG90S电机。但是参考了2代的python代码,第一次运行后,无法第二次运行,似乎会被占用,请问这是为什么?
错误代码:
root@WalnutPi:/home/pi/Documents# python PWM.py
OSError: [Errno 16] Device or resource busy
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/home/pi/Documents/PWM.py”, line 47, in
pwm_export(0, 1) # \u5bfc\u51faPWM\u901a\u9053
^^^^^^^^^^^^^^^^
File “/home/pi/Documents/PWM.py”, line 20, in pwm_export
write_to_file(f"{control_path[control]}/export", str(channel))
File “/home/pi/Documents/PWM.py”, line 12, in write_to_file
with open(path, “w”) as f:
OSError: [Errno 16] Device or resource busy
感谢,如果需要更多信息,麻烦告知。