Help with code

Could some one help me write code to make a switch on channel 0 command moment on servos on channel 1 and 2?

I have this code,

[code] begin
0 get_position 500 less_than if movement endif
repeat

sub movement
  8000 1 servo  #8000 is the maximum value it goes to, change it to your needs
  500 delay     
  5000 1 servo  #5000 is the middle value, change it to your needs
  500 delay
  return

[/code]

How can i make this command more a servo on channel 2 also?

Hello.

From your script, it looks like you are only sending target values to channel 1 in your movement subroutine. To send a target position value to a specific channel, you would need to precede the SERVO command with the channel number. For example:

5000 2 servo    # sets channel 2 position to 5000 (1.25ms)

You might consider looking at the “Command Reference” section in the Maestro User’s Guide to get a better understanding of the Maestro scripting language, particularly the SERVO command.

By the way, the “Example Scripts” section of the user’s guide I linked to above has a “Using a button or switch to control servos” example that you might find helpful. You could copy that script into the Maestro Control Center and step through the script using the “Step Script” button to see the affect of each line of code. The “Step Script” button can be found under the “Script” tab of the Control Center.

- Amanda