Hi I am new here mostly hardware back ground. I am having trouble getting a simple 2 servo system controlled via switch to activate the sequence. I have the sequence works fine from the Maestro control center. I have four frames with two servos in each. I have the switch wired to #2 and servos in #0 and #1. I have verifies the switch activating in the controller and it runs fine from the controller software but I cannot get it to work without the pc and using the switch to step through the frames. I am in disparate need of a fix for this and I am sure this will help me learn some of what I am missing. I have added wait_for_button_press and sub button 2 get_position 500 less_than Lines to various places in the file with no results. It should simply set to first frame on turn on or return frame ) is Home, and tab to next fram when switch is hit continuing in loop.
Here is the script that works in the system. Any help would be so greatly appreciated. New to the software side of this… THANKS
# TONY 1
begin
500 6363 7608 frame_0_1 # Frame 0
500 6023 8000 frame_0_1 # Frame 1
500 6119 5357 frame_0_1 # Frame 2
500 6179 4242 frame_0_1 # Frame 3
repeat
sub frame_0_1
1 servo
0 servo
delay
return
This is with the lines added to get the switch to step through the frames. It does not seem to work. The switch shows in the test with the control software but does not seem to do anything when testing with out the pc hooked up.
# TONY 1
begin
sub button 2 get_position 500 less_than
sub wait_for_button_press
500 6363 7608 frame_0_1 # Frame 0
500 6023 8000 frame_0_1 # Frame 1
500 6119 5357 frame_0_1 # Frame 2
500 6179 4242 frame_0_1 # Frame 3
repeat
sub frame_0_1
1 servo
0 servo
delay
return
I have also used the following wait_for_button_open_10ms
wait_for_button_closed_10ms
But when I add it I get error already recognized. I am lost on this and despeeratly need help.
# TONY 1
begin
wait_for_button_press
6363 0 servo
7608 1 servo
wait_for_button_press
6023 0 servo
8000 1 servo
wait_for_button_press
6119 0 servo
5357 1 servo
wait_for_button_press
6179 0 servo
4242 1 servo
repeat
# Returns 1 if the button is pressed, 0 otherwise.
sub button
2 get_position 500 less_than
return
# Waits for a button press, with debouncing.
# (Requires the BUTTON subroutine.)
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 pressed
button
if
get_ms over minus 10 greater_than
if drop return endif
else
drop get_ms
endif
repeat