i need a simple command.
0 is servo
5 is push button
When press pushbutton for 5 sec to open servo when its close or close it when its open.
If the press of button is less than 5 seconds do not change the state.
Thank you
i need a simple command.
0 is servo
5 is push button
When press pushbutton for 5 sec to open servo when its close or close it when its open.
If the press of button is less than 5 seconds do not change the state.
Thank you
Hello.
Have you tried writing a script that does what you want? If so, can you post the script you have so far and specify where you got stuck? If you have not tried writing your own script, I would recommend starting by reviewing the “Using a button or switch to control servos” example under the “Example Scripts” section of the Maestro’s user’s guide. You can find the user’s guide under the “Resources” tab of the Maestro’s product page. One way to achieve your pushbutton behavior is to create your own version of wait_for_button_closed_10ms
that waits for 5000ms instead of 10ms, which can be done by substituting 5000 in for the 10, like this:
sub wait_for_button_closed_5000ms
get_ms
begin
# reset the time on the stack if it is not pressed
button
if
get_ms over minus 5000 greater_than
if drop return endif
else
drop get_ms
endif
repeat
You can try using that subroutine along with the “button” subroutine in your script and adding the part to get your servo to open and close the way you want it to. If you run into problems, you can post your script, and I’d be happy to help.
-Jon