ı have maestro 12. When the button is connected to the 6th channel and this button is pressed, I want the servomotors of channel 0,1,2,3,4,5 and 7 to move 15 degrees and wait for 10 seconds and return to the previous position. Please help with the script. I am very nervous
If you have not done so already, you will need to configure channel 6 (your button pin) to be an input in the “Channel Settings” section of the Maestro Control Center. Also, it should be connected as described in the “Button or switch” heading of the “Attaching Servos and Peripherals” section of the Maestro user’s guide.
Then, you can use the
GET_POSITION command to read the state of the switch and an
IF statement to only move the servos if the button is pressed. The structure of the script could look something like this:
begin 6 get_position 500 less_than if #check the button on channel 6 #move servos 15 degrees if button was pressed 10000 delay #wait for 10 seconds #move servos back endif repeat
You will need to determine for your servos what target position to send to get them to move to the desired location. One way to find these values is to use the sliders in the “Status” tab of the Maestro Control Center to move the servos manually. Please note that the target shown on the slider is in units of microseconds and the values used with the
SERVO command in your script should be in quarter microseconds, so you will need to multiply them by 4 to get the same position.
If you have trouble getting it to work, you can post the script you have so far, and I would be glad to take a look.
4 times 4000 plus
This code is the only 1 servo running. How do I add other servo
That code looks like it is intended to control a servo from an analog input, so just adding more servos to that would not do what you described in your first post.
You can set a target position for a Maestro servo channel by using the
SERVO command in a script. The
SERVO command requires two arguements: the target position and the servo channel. For example,
6000 5 servo will set the target position of channel 5 to 1500 microseconds (which is 6000 quarter microseconds). You can find more information about the
SERVO command and other commands for the Maestro in the “Command Reference” section of the Maestro user’s guide.
To move your servos using a button push, you should be able to use the code I posted above and add the appropriate
SERVO comamnds where I mentioned in the comments of the code.