Maestro 12 loop interrupted sequence for audio

Hi there,
I currently have a working animatronic that uses a Maestro 12 to run a looping sequence at startup to continuously move his head around. I just turn him on and he starts looking around. I’d like to now make him “talk” with an additional servo in his jaw along with an array of short audio files. I’d most likely purchase an adafruit audio FX for audio.

I’m wondering if it’s possible to have that looping sequence running alongside a button-triggered sequence of audio/servo animation.

To put it in plainer words: Can I have his head movement continuously loop while triggering audio/servo animation on a different channel? Then every button press moves onto the next audio file? Or do I have to have my head movement stop, then retrigger the looping head animation after every button press?

Hello.

You cannot have multiple scripts running in parallel like that. You could probably combine the functionality into a single script, but doing so would be tricky and would involve avoiding the delay command (which is blocking) and storing variables on the stack to keep track of the progress of each sequence. If you want to try doing that, I recommend referencing this example that David posted, which shows how to have 3 buttons control 3 servo sequences in parallel.

Depending on the specifics of your system, an alternative solution could be adding a second Maestro controller to just control the “talking” portion separately from the head motion.

Brandon

I see, this is what I figured but wanted to make sure. Thanks for the example project link, I’ll see if I can get it working with one script but if not I can do the trusty 2 maestro method. I appreciate your reply!

1 Like