BU Design Robot Program Help

Hey guys, long time no see.

I have come to ask for some assitance in writing code for a robot that i have made for a Competition that being held at BU. As of right now i am using the Bot Board Along with the Basic Atom 28. I have been staring at the manual and existing code as well as playing with the Basic Atom Software all day, but alas, I have no luck.

Currently the robots has 2 servos, and 2 buttons that I need input from, but i can’t seem to attain. Basically I need one servo to go to a certain position upon start up (I tried doing my own program for this cause I thought it was straight forward, but I couldn’t get it to work) Then have the micro tell the Sabertooth 2 x 10 to run a motor until a switch is pushed. Then I need another servo to go to another position. After that i need the robot to reverse the motor direction and keep moving until a second switch is pushed which at that time i want it to stop.

[code]

Bumper (Constant Definition)
Switch (Constant Definition)

main

servo P4, 900

if Bumper = 0
PWM Motor 1
elseif Bumper = 1
gosub Catapault
endif

goto main
endmain

Catapault

servo P5, 1000

if switch = 0
PWM Motor 1 (Reverse Direction)
elseif switch = 1
PWM Motor 1 (Stop Motion)

end catapault[/code]

Thats the basic outline of what needs to be done. If anyone could help I’d be incrdibly greatful considering this 'bot has to be up and running by sunday :open_mouth:

Well, any help is appreciated

   -Jared

So, could anyone lend a hand? i need to get this thing up and running by sunday, and ANY help would be appreciated, as of right now im in the middle of the ocean in a conoe without a paddle

The answer to how to read a pin and use its value in a conditional lies in this thread lynxmotion.net/viewtopic.php?t=3841 for a BAP. Is it the same for a BA or not I don’t know.

If you are telling a servo to move to a position, then checking for a condition that results after some movement of a servo, then your code will probably need some type of delay between the servo being commanded to go to a position and then subsiquently checking for the resulting condition from the servo movement.