Hi, surprisingly the code is working correctly for how I’m using the switch but servo 7 is not moving how I want it to. It only moves to it’s min channel setting, I want it to move to it’s max channel setting. Here is my script, which is mostly copied from the example in the user’s guide.
goto main_loop # Run the main loop when the script starts
sub button
5 get_position 500 less_than
return
# This subroutine uses the BUTTON subroutine above to wait for a button press,
# including a small delay to eliminate noise or bounces on the input.
sub wait_for_button_press
wait_for_button_open_10ms
wait_for_button_closed_10ms
return
# Wait for the button to be NOT pressed for at least 10 ms.
sub wait_for_button_open_10ms
get_ms # put the current time on the stack
begin
# reset the time on the stack if it is pressed
button
if
drop get_ms
else
get_ms over minus 10 greater_than
if drop return endif
endif
repeat
# Wait for the button to be pressed for at least 10 ms.
sub wait_for_button_closed_10ms
get_ms
begin
# reset the time on the stack if it is not pressed
button
if
get_ms over minus 10 greater_than
if drop return endif
else
drop get_ms
endif
repeat
main_loop:
begin
frame
repeat
sub frame
wait_for_button_press
1024 3 servo 500 delay
2000 7 servo
Return