# How would i trigger a sequence with a button (mini maestro 12)

**URL:** https://forum.pololu.com/t/how-would-i-trigger-a-sequence-with-a-button-mini-maestro-12/13603
**Category:** Servo controllers and servos
**Created:** [November 2, 2017, 8:50pm UTC](https://forum.pololu.com/t/how-would-i-trigger-a-sequence-with-a-button-mini-maestro-12/13603 "2017-11-02T20:50:49Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![BrandonM](https://forum.pololu.com/user_avatar/forum.pololu.com/brandonm/32/609_2.png) [@BrandonM](https://forum.pololu.com/u/BrandonM)
#### Post date: [November 2, 2017, 11:26pm UTC](https://forum.pololu.com/t/how-would-i-trigger-a-sequence-with-a-button-mini-maestro-12/13603/2 "2017-11-02T23:26:11Z")

</div>

Hello, James.

Probably the simplest way to start your script with a button press is to add a `WHILE` loop to the beginning that exits when the button is pressed. You can find some code for doing this in [my post here](https://forum.pololu.com/t/maestro-6-channel-starting-sequence/11737/5). Please note that the code there is for a button on channel 5; you can change the 5 to a 0 to make it work for your button on channel 0.

If you put the `WHILE` loop before your `BEGIN/REPEAT` loop, the sequence will repeat forever once the button is pressed. If you want the sequence to wait for the button every cycle, you can put the `WHILE` loop inside of your current `BEGIN/REPEAT` loop.

Brandon

---

_[View the full topic](https://forum.pololu.com/t/how-would-i-trigger-a-sequence-with-a-button-mini-maestro-12/13603)._
