NEED HELP WITH Maestro Micro

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

[code]

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[/code]
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.

[code]

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[/code]
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

I am looking for anyone who can assist or solve this for me I am willing to pay for the assistance. I am up against a deadline that is costing me $. If you can offer a solution (correct code) Please let me know my clock is ticking.

Thanks

Hello

After talking to another Pololu employee, it sounds like you called us a couple of times and worked out your problem. Also, it sounds like the last code that you posted is working how you want it to. I am glad you were able to get it working. I understand you were under a time deadline for this, but if you run into problems and have additional questions in the future, you can post here or make a new thread, and we would be happy to help.

By the way, when posting code, please use the code tags to display your code nicely in your post. I have edited your post to include them. I also noticed that you edited your post to include some code that was not originally there, but did not make any mention of it. Generally, we prefer making a new post to update your thread with additional information. This makes it much easier for others to follow, and edits can often go unnoticed.

-Brandon