Pololu Maestro - delay after button press

Hi everyone I’m new here :slight_smile:

I’m newbie to writing scripts for servo controllers and need some help. I have a simple script for right now which is controlling servos depend on which button is pressed. I have 4 buttons and 8 servos (1 button is controlling 2 servos).
What I want to do. I want to set delay 1-2 sec after button press and then start sequence. Now when I press button sequence starts immediatly.

Below is a part of script for 1 button and 2 servos. Thank you for any help.

0 1 acceleration
70 1 speed

0 2 acceleration
70 2 speed

begin
  button_a if sequence_a endif
repeat

sub button_a
  0 get_position 500 less_than 
return

sub sequence_a
  2000 1 servo 3000 delay
  8000 1 servo 3000 delay
  2000 2 servo 3000 delay
  7770 2 servo 
 return

Hello.

You could add that delay at the beginning of your subroutine like this:

sub sequence_a
  2000 delay # delays 2000 milliseconds
  2000 1 servo 3000 delay
  8000 1 servo 3000 delay
  2000 2 servo 3000 delay
  7770 2 servo 
 return

or you could add the delay after the Maestro recognizes the button was pressed, but before the subroutine is called like:

begin
  button_a if 2000 delay sequence_a endif
repeat

-Jon