This commit is contained in:
2024-12-25 20:45:31 +01:00
parent 5bfe2296e8
commit a0b1f9dfb7
2 changed files with 35 additions and 581 deletions

35
manualControl.py Normal file
View File

@@ -0,0 +1,35 @@
import time
from adafruit_servokit import ServoKit
# Initialize ServoKit
kit = ServoKit(channels=16)
# Constants for delay
DELAY = 1
# Function to move a specified leg to a specified angle
def move_leg(leg, angle):
print(f"Moving leg {leg} to angle {angle}.")
kit.servo[leg].angle = angle
time.sleep(DELAY)
# Main function
def main():
while True:
try:
leg = int(input("Enter the leg number (0-15): "))
if leg < 0 or leg > 15:
print("Invalid leg number. Please enter a number between 0 and 15.")
continue
angle = int(input("Enter the angle (0-180): "))
if angle < 0 or angle > 180:
print("Invalid angle. Please enter a number between 0 and 180.")
continue
move_leg(leg, angle)
except ValueError:
print("Invalid input. Please enter numeric values.")
if __name__ == "__main__":
main()