1 servo with 2 buttons step left and right

Hi, I testet a lot but it seems so that Iam to stupid to get this work.

I try to get a servo drive clockwise and anticlockwise in steps to go with the maestro 6-cannel board.

Backround, i want to controll a small outboard engine carburator with a remote control-relais on the inputs 0-1 ana a servo on 4.

in future with a input on 3 to put the servo on 4 in low idle speed and a relais on 5 to cut the engine off.

hope anybody can give me a little help.

sorry for my bad englisch, Iam from bayaria, germany.


There is definitely a learning curve with the Maestro scripting language if you are not familiar with a similar programming language like Forth, but I would be glad to help you figure it out. Our “Using multiple buttons or switches to control servos” example is probably a good start for what you are trying to do. You can find that example in the “Example Scripts” section of the Maestro user’s guide.

That example uses 3 buttons, so you can remove lines 7, 25-27, and 43-47 since those are specific to the third button. Then, you can modify the sequence_a and sequence_b subroutines to move servo 4 to the 2 positions you want. If you try doing this and run into problems, you can post your script (or settings file, which contains your script) and I will take a look. You can save your settings file from the “File” drop-down menu of the Maestro Control Center, while the controller is connected.


Thanks a lot, I will try it and give a answer whats going.


Hin Brandon, now I have tried some settings. It seem to that I get a little bright in this language.
2 Things are not possible:
how should it be that the servo drives very slow and stop to the position at the moment where the input goes to 0.

# is pressed it runs the corresponding sequence.
  button_a if sequence_a endif
  button_b if sequence_b endif
# These subroutines each return 1 if the corresponding
# button is pressed, and return 0 otherwise.
# Currently button_a is assigned to channel 0, 
# button_b is assigned to channel 1, and
# button_c is assigned to channel 2.
# These channels must be configured as Inputs in the
# Channel Settings tab.
sub button_a
  0 get_position 500 less_than
sub button_b
  1 get_position 500 less_than
# These subroutines each perform an arbitrary sequence
# of servo movements.  You should change these to fit
# your application.
sub sequence_a
  4000 4 servo 1000 delay

sub sequence_b
  8000 4 servo 1000 delay



It sounds like you want the servo to incrementally change position when you press each button and stay where it is when neither is pressed. To do that, you would just need to modify your subroutines slightly so that instead of commanding a hardcoded position, they read the current position of the servo and add or subtract to it. For example:

sub sequence_a
  4 get_position  #get the current position of the servo
  1 plus		#add to it
  4 servo 1 delay  #update the servo and have a small delay


For your other subroutine (sequence_b), you would just need to change the plus to a minus. Also, please note that you can increase the delay to make it increment slower, or increase the amount you are adding (or subtracting) to make it move faster (or remove the delay).


This sound great. I will try it.

Thank you very much for this.


1 Like

I have tested it and now it runs great.

thank you verry much


1 Like