浏览代码

fix servo script

Silas Gruen 5 月之前
父节点
当前提交
9a9b8fe69f
共有 1 个文件被更改,包括 2 次插入5 次删除
  1. 2 5
      playgrounds/servo.py

+ 2 - 5
playgrounds/servo.py

@@ -15,7 +15,7 @@ def main():
             break
             break
 
 
         if not pi.connected:
         if not pi.connected:
-            raise RuntimeError(f"Failed to connect to pigpio daemon for pin {pin}")
+            raise RuntimeError(f"Failed to connect to pigpio daemon for pin {servo_pin}")
         
         
         try:
         try:
             angle = float(cmd)
             angle = float(cmd)
@@ -31,9 +31,6 @@ def main():
             
             
         except Exception as e:
         except Exception as e:
             print(f"Invalid input: {e}")
             print(f"Invalid input: {e}")
-        finally:
-            pi.write(servo_pin, 0)
-            pi.stop()
-
+            
 if __name__ == "__main__":
 if __name__ == "__main__":
     main()
     main()