# testServo.py code in python
# Assumes the maestro python files are in a subdirectory call Maestro of  /home/pi
import maestro
import time

# Initialize the Maestro controller
# Replace 'COM3' with your specific serial port (e.g., '/dev/ttyACM0' for Linux) 
servo = maestro.Controller('/dev/ttyACM0')

# Set acceleration for servo 0 (optional, 0 for unrestricted)
servo.setAccel(2, 4) 

# Set speed for servo 0 (optional, 0 for unrestricted)
servo.setSpeed(2, 10) 

# Set target position for servo 0 (e.g., 6000 for center position)
# Target values are typically in quarter-microseconds (e.g., 4000 = 1ms, 8000 = 2ms)
servo.setTarget(2, 6000) 

# Pause to allow the servo to move
time.sleep(1.5) 

# Move to another position
servo.setTarget(2, 4000) 
time.sleep(1.5)

# Close the connection to the Maestro
servo.close()