I have a Maestro 8 servo controller and a DSM44 servo. My goal is to have the servo (CH3) actuate between between two positions based on a TTL signal coming in on CH0.
Looking at the software when connected via USB, on the “Status” tab I can see the input line and actuate the servo with the slider. However, I’m not able to actuate the servo with a script. See my code below. Stepping through it, everything makes sense. The right parts of the if statement are entered based on the status of CH0, but the servo never actuates.
Can anyone help?
goto main_loop # Run the main loop when the script starts.
sub TTL # Subroutine for checking the TLL line status.
0 get_position 512 less_than
return
# This subroutine returns 1 if the TTL line is high, 0 otherwise.
# To convert the input value (0-1023) to a digital value (0 or 1) representing
# the state of the button, we make a comparison to an arbitrary threshold (500).
main_loop:
BEGIN
TTL # Run the TTL subroutine.
if
1200 3 SERVO # this part is run when input3 < 512
else
1808 3 SERVO # this part is run when input3 >= 512
endif
REPEAT