# Using a GPIO Input to alter a pattern

**URL:** <https://forum.electromage.com/t/using-a-gpio-input-to-alter-a-pattern/4556>\
**Category:** Troubleshooting\
**Created:** [October 16, 2025, 5:09am UTC](https://forum.electromage.com/t/using-a-gpio-input-to-alter-a-pattern/4556 "2025-10-16T05:09:13Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![wizard](https://forum.electromage.com/user_avatar/forum.electromage.com/wizard/32/4_2.png) [@wizard](https://forum.electromage.com/u/wizard)\
**Post date:** [October 16, 2025, 4:31pm UTC](https://forum.electromage.com/t/using-a-gpio-input-to-alter-a-pattern/4556/2 "2025-10-16T16:31:48Z")

</div>

Two approaches.

You could do this in one pattern, basically use if in code to do something when a gpio is a particular level. Could use delta to control timing to have it run for a minimum period or fade in/out.

Another way is to use playlists and the sequencer api. You can jump to a specific playlist position.

some related posts:

> [@The Technocolour Dreamcoat, phone-free Burning Man 2023 edition!](https://forum.electromage.com/t/the-technocolour-dreamcoat-phone-free-burning-man-2023-edition/3115/3):
>
> Well, sure. Here’s the code: export function beforeRender(delta) { // ... // enable next/forward buttons debounceNext(delta) debouncePrev(delta) } export var analogInputs var DEBOUNCE\_TIME = 40; var nextBtnState; var nextBtnTimer; function debounceNext(delta) { var newState = analogInputs[2] \> 0.5; if (newState == nextBtnState) { nextBtnTimer = 0; } else { nextBtnTimer += delta; } if (nextBtnTimer \> DEBOUNCE\_TIME) { nextBtnState = newState; if (nextBtnStat…

> [@API for changing patterns (… in a playlist)?](https://forum.electromage.com/t/api-for-changing-patterns-in-a-playlist/3108/5):
>
> Good news @ratkins ! Here’s a beta build with sequencer APIs. This should let you implement what you are looking for with a bit of pattern code. You’ll need to copy some code to each pattern for reading/debouncing SB inputs and going next/prev, but cleaner than making a mega pattern. Standard: [v3.49.pb32.stfu](https://forum.electromage.com/uploads/short-url/nnju0XfFsrRvgdXVvMo33WiVfnV.stfu) (1.4 MB) Pico: [v3.49.pico32.stfu](https://forum.electromage.com/uploads/short-url/vFY0A0UZaj7ueBmc2fRj4lJQNu6.stfu) (1.4 MB) Docs haven’t been updated, but here’s what’s new: sequencerNext() Universal advance to next pattern, pretty much the same as button press. Th…

Hardware wise, if it’s 3.3v then you can wire it directly.

---

_[View the full topic](https://forum.electromage.com/t/using-a-gpio-input-to-alter-a-pattern/4556)._
