Motors and servos running seperatly

4 replies [Last post]
firetiger5
firetiger5's picture
Title: NooBot
Joined: 05/03/2012
Posts:
BotPoints: 23
User offline. Last seen 10 years 18 weeks ago.

I have programmed the robot (CBC robot) to use its motors to move and then stop, then the servos move the claw to collect the Kelp then move the motors toward the next Kelp. But when the robot runs the servos close the claw and move toward the next set of kelp at the same time. How can I make it so that they go in order?

~ARIGATO
-From firetiger5

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 7 years 18 weeks ago.

Use the sleep function to wait for the servo to move. If you want better accuracy for the delay, you could attach a touch sensor to detect when the servo has moved.

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS

firetiger5
firetiger5's picture
Title: NooBot
Joined: 05/03/2012
Posts:
BotPoints: 23
User offline. Last seen 10 years 18 weeks ago.

Alright, thanks but would there be another way because the sleep seems to stop both the motor and the servo then makes them go togheter again which is not what i would like to happen?

~ARIGATO
-From firetiger5

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 7 years 18 weeks ago.

Can you post a code snippet of what you're doing? As long as you have the sleep call between the servo command and the motor command, it should work fine.

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS

firetiger5
firetiger5's picture
Title: NooBot
Joined: 05/03/2012
Posts:
BotPoints: 23
User offline. Last seen 10 years 18 weeks ago.

alright, it seems to be having a very short delay but it stills works so thank you very much

~ARIGATO
-From firetiger5