There are probably multiple ways you could go about doing something like that. If you want the subroutines to wait for a specific button to be pressed, one option might be to duplicate the
wait_for_button_closed_10ms subroutines in the "Using a button or switch to control servos" example script and modified the duplicates to work for a button on a different channel (please note that you would need to modify the names of the duplicate subroutines as well). It might be more efficient to try modifying those subroutines so you can pass them a channel number, so you could use the same subroutines for both buttons. However, if you want to monitor both buttons and run a different sequence depending on which button is pressed (essentially behaving like the
Using multiple buttons or switches to control servos example, but with debouncing), you will likely need a different approach.
I came up with the subroutine below to check an input channel for a button press and do some debouncing. It needs to be passed the channel number of the button, so you can use this same subroutine for both of your inputs (e.g.
0 button_debounce would check the input on channel 0). This subroutine should return 1 if the button has been pressed for the debouncing time (I used 100 in the sample), and 0 if the button is released before that time. Please note that the program will stay in the subroutine for the duration of the debouncing time if the button is being pushed the whole time.
get_ms #get current time and put it on stack
swap dup get_position 500 less_than #check if specified button is pressed
swap get_ms over minus 100 greater_than #return 1 if it has been pressed for 100ms+
if drop drop 1 return endif
else #if button is released before specified time return 0
drop drop 0 return
repeat #if button is still being held and it has not been 100ms repeat subroutine