Quote:
Originally Posted by waiakea2024
We have been working on our autonomous mode and we cant figure out how to make a delay. Our mentor has tried to make his own but the bot wont recive it. Any Suggestions or ideas? Thanks!
|
I would like to say that FFR, the real best way to do this is to have a quadrature encoder on the arm. But let's do it your way since that's the hardware!
Basically to make a delay, without going into using the onboard timers, is to increment a loop counter every loop and have a test statement which will do something when a certain number of loops has elapsed.
Pseudocode:
if(arm_is_moving && loops < NEEDED_LOOPS)
{
loops++;
}
if(arm_is_moving && loops = NEEDED_LOOPS)
{
arm_pwm=127;
arm_is_moving=0;
loops=0;
}
This is quick and ugly, and it would be more elegant to use the timers or have an encoder. But it'll work in a pinch.
I hope this helps. If we see each other at a regional I can help you some more, or post again or use a PM.
Ari.