I need a little help. This is a simple button(5) code just to open close a servo(0),
The only change i need is my main loop to be activated when i press the button for 5 secconds. Thank you
goto main_loop
sub button
5 get_position 500 less_than
return
sub wait_for_button_press
wait_for_button_open_10ms
wait_for_button_closed_10ms
return
sub wait_for_button_open_10ms
get_ms # put the current time on the stack
begin
button
if
drop get_ms
else
get_ms over minus 10 greater_than
if drop return endif
endif
repeat
sub wait_for_button_closed_10ms
get_ms
begin
button
if
get_ms over minus 10 greater_than
if drop return endif
else
drop get_ms
endif
repeat
main_loop:
begin
800 frame
8000 frame
repeat
sub frame
wait_for_button_press
0 servo
return