mirror of
https://github.com/apirrone/Open_Duck_Mini_Runtime.git
synced 2025-09-02 19:23:54 +00:00
trying to fix antennas twitching
This commit is contained in:
parent
84244b8574
commit
ae3a564a4c
1 changed files with 15 additions and 15 deletions
|
@ -36,22 +36,22 @@ class Antennas:
|
|||
:param servo: 1 for the first servo, 2 for the second servo
|
||||
:param value: A float between -1 and 1
|
||||
"""
|
||||
pass
|
||||
# if value == 0:
|
||||
# return
|
||||
# if -1 <= value <= 1:
|
||||
# angle = self.map_input_to_angle(value * sign)
|
||||
|
||||
# duty = 2 + (angle / 18) # Convert angle to duty cycle (1ms-2ms)
|
||||
# if servo == 1:
|
||||
# self.pwm1.ChangeDutyCycle(duty)
|
||||
# elif servo == 2:
|
||||
# self.pwm2.ChangeDutyCycle(duty)
|
||||
# else:
|
||||
# print("Invalid servo number!")
|
||||
# # time.sleep(0.01) # Allow time for movement
|
||||
# else:
|
||||
# print("Invalid input! Enter a value between -1 and 1.")
|
||||
if value < 0.1:
|
||||
return
|
||||
if -1 <= value <= 1:
|
||||
angle = self.map_input_to_angle(value * sign)
|
||||
|
||||
duty = 2 + (angle / 18) # Convert angle to duty cycle (1ms-2ms)
|
||||
if servo == 1:
|
||||
self.pwm1.ChangeDutyCycle(duty)
|
||||
elif servo == 2:
|
||||
self.pwm2.ChangeDutyCycle(duty)
|
||||
else:
|
||||
print("Invalid servo number!")
|
||||
# time.sleep(0.01) # Allow time for movement
|
||||
else:
|
||||
print("Invalid input! Enter a value between -1 and 1.")
|
||||
|
||||
def stop(self):
|
||||
self.pwm1.stop()
|
||||
|
|
Loading…
Reference in a new issue