Maintaining servo position

I am using an 18-channel mini maestro controller. I have two servos that open and close compartments. I am attempting to add a loop to my script that will hold the servos in the closed position when their sub routine is not running. The problem with the loop is if I command the compartments to open the loop will immediately close the compartment.

When I load the script in command center an error stating “Error applying parameters: value cannot be null parameter name: key” is displayed after selecting “Apply Settings”.

I am a novice to writing code and used ChatGPT to help, but it is missing something. Any help is appreciated.

Below is the excerpt of my script.

# Behavior 1: Hold servo 14 and 15 positions
sub behavior1
  7627 14 servo # Hold servo 14 position
  4542 15 servo # Hold servo 15 position
  return

# Main loop
begin
  call behavior1
  1000 delay
  call Launchers_Open
  launcher_open_flag retrieve if
    15000 delay
    0 launcher_open_flag store
  endif
repeat

Thank you

Hello.

It looks like ChatGPT is a little confused about the Maestro scripting language; there is no call command. To call the subroutine you can just use the name of the subroutine. So, deleting the call commands before your subroutine calls should get rid of the error you mentioned. (By the way, while I generally recommend learning the Maestro scripting language yourself, letting ChatGPT know in your prompt that the Maestro scripting language is a stack-based programming language similar to Forth seems to help a bit.)

In general, you shouldn’t have to do anything special for the Maestro to hold the servo in a position; after you send the target position command, the Maestro will continue commanding that servo to the target position until you tell it to change. But if you continue having trouble, you can post a copy of your full Maestro settings file and I would be happy to take a look. You can save a copy of your settings file from the “File” drop-down menu of the Maestro Control Center software while the controller is connected.

Brandon