Triggering a script with a button

Hi, I am trying to use a button to trigger a sequence on the 6 channel maestro control board.

So far I have verified that all my wiring connections are correct. I am getting the correct reading on the status for the button. (0 when pressed and 255 when open) My button is on header 0 and servo is on header 1.

I have gone through the forum and saw the use of the get_position command and have tried to apply that but I’m not sure if I’m using it correctly.

Is there something that I’m missing? I would like for the scene to be triggered by the button, play, then wait to be triggered again.

Thanks!
maestro_settings.txt (2.2 KB)

Hello, johnd3.

Thank you for including your settings file and screenshot.

It looks like you are on the right track, but the way you have your code laid out right now, when it exits the WHILE loop, it picks up after the REPEAT statement. So, to fix this, you will need a BEGIN/REPEAT loop dedicated to the WHILE statement. For example:

begin

  begin
  0 get_position 500 greater_than while  
    #while button is not pushed code inside of this while loop will run
  repeat

     #once the button is pushed, this code will loop through
  500 4966 0 0 0 0 frame_1..5 # Frame 0
  500 4711 frame_1 # Frame 1
  500 8000 frame_1 # Frame 2
repeat

Please note that doing it this way will cause your sequence to trigger 1 time before the code loops back around and checks the button again. If you want the sequence to loop forever once the button is pressed, you can move the BEGIN/REPEAT block that has the WHILE statement in it to the beginning of the code, outside of the main BEGIN/REPEAT block (e.g. before the BEGIN statement in the example code above).

Brandon

Great Thanks! It worked. Another question: Is it possible to do this setup using VSA. For example I want to record a scene using VSA and then download it to the maestro. I still need the scene to be triggered by the button.

I am creating an animatronic crow, which uses 4 servos and 2 leds and I am able to make it super realistic when I record a show on VSA so I would like to download it to the maestro and use the button to trigger it? Is this possible?

If not, do you have any recommendations on making movements as smooth and realistic as possible, as saving it frame by frame creates a choppy and less desirable servo movements.

Thanks for your help!

The Visual Show Automation (VSA) software from Brookshire Software can control the Maestro from your computer via USB, but you cannot upload your VSA program to the Maestro (like you can with a script). You might be able to use their Remote Advanced Playback Unit (RAPU) in place of your computer for a more portable option.

Alternatively, if you decide to do it all through a Maestro script, you might try adding some acceleration and speed limiting to make the motions smoother. Speed and acceleration limits can be set in the “Channel Settings” tab of the Maestro Control Center for each channel. Additionally, if you need to change the speed or acceleration setting at different times throughout your script, you can use the “SPEED” or “ACCELERATION” commands. More information about these commands can be found in the “Command Reference” section of the Maestro user’s guide.

Brandon