Simple Servo Script: Changing Target Position

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

Hello.

I moved your thread to the “Servos controllers and servos” section of our forum since it seems more appropriate.

We do not carry an 8-channel Maestro servo controller. We used to make a serial servo controller that had 8 channels, but it did not support on-board scripting like the Maestro, so I suspect you are referring to either the 6-channel Micro Maestro or 12-channel Mini Maestro.

It looks like the values you used in your script are probably in units of microseconds instead of quarter microseconds. The servo command in the Maestro scripting language uses units of quarter microseconds, so to send the servo on channel 3 a target position of 1200 microseconds the command should be 4800 3 servo. Similarly, to send it a target position of 1808 microseconds, the command would be 7232 3 servo.

Brandon

That was the issue, thanks for your help.