mirror of
https://github.com/apirrone/Open_Duck_Mini_Runtime.git
synced 2025-09-03 11:43:58 +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 servo: 1 for the first servo, 2 for the second servo
|
||||||
:param value: A float between -1 and 1
|
: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 value < 0.1:
|
||||||
# if servo == 1:
|
return
|
||||||
# self.pwm1.ChangeDutyCycle(duty)
|
if -1 <= value <= 1:
|
||||||
# elif servo == 2:
|
angle = self.map_input_to_angle(value * sign)
|
||||||
# self.pwm2.ChangeDutyCycle(duty)
|
|
||||||
# else:
|
duty = 2 + (angle / 18) # Convert angle to duty cycle (1ms-2ms)
|
||||||
# print("Invalid servo number!")
|
if servo == 1:
|
||||||
# # time.sleep(0.01) # Allow time for movement
|
self.pwm1.ChangeDutyCycle(duty)
|
||||||
# else:
|
elif servo == 2:
|
||||||
# print("Invalid input! Enter a value between -1 and 1.")
|
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):
|
def stop(self):
|
||||||
self.pwm1.stop()
|
self.pwm1.stop()
|
||||||
|
|
Loading…
Reference in a new issue