Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Maestro with Arduino control

Maestro scripting can have a little bit of a learning curve if you’re new to that kind of programming language (it’s based on Forth), but I would encourage you to continue with it, as you are really close to getting it working how you want. You just need to add one or two commands manually.

There are 2 ways to transfer sequences to the “Script” tab: the “Copy Sequence to Script” button and the “Copy all Sequences to Script” button. They each function slightly differently. Unfortunately, no matter which one you use, you need to do some slight modifications to the script to get it to work with the “Restart Script at subroutine” command.

The “Copy Sequence to Script” button formats the script in a way that sets it up to loop endlessly when you play the script, which is useful if you want the Maestro to be a standalone controller that simply plays a sequence when powered. However, the main loop is not generated inside of a subroutine, so the “Restart Script at subroutine” command will not work correctly with it. To get it to work with that command, you can put the main loop inside of a subroutine, which you can do by adding something like sub NameOfSequence before it, like I suggested in my last post. For example, your script would start like this:

sub Sequence3
  begin
    1000 1984 0 0 0 0 0 frame_0..5 # Frame 0
    1000 9984 frame_0 # Frame 1
  repeat

Alternatively, if you use the “Copy all Sequences to Script” button, each of the sequences you saved in the “Sequence” tab will be inserted into the bottom of your existing script in their own subroutine. This is useful when you want to add logic to the sequence that the Maestro’s Sequencer doesn’t handle, such as processing sensors, pushbuttons, or switches (or even changing speed and acceleration between frames). To use this method with the “Restart Script at subroutine” command, I recommend deleting any existing script before clicking the “Copy all Sequences to Script” button. After that, you will still need to modify the subroutines containing your sequences, because they will end in a RETURN command, and since you are commanding the Maestro to start the script at that subroutine, there is nowhere for it to return to. If you only want the sequence to play through once, you can simply add a QUIT before the RETURN. If you want it to loop endlessly, you can start the subroutine with a BEGIN and put a REPEAT before the RETURN.

Brandon