![]() |
Delay Help!
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!
|
Re: Delay Help!
We are trying to make our arm move and then stop without it hitting the ground and messing up the motor.
|
Re: Delay Help!
Quote:
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. |
Re: Delay Help!
that didnt work :l thanks for the help though
|
Re: Delay Help!
Well if you copied and pasted his code, then you should change the '=' to '==' :)
Also 'loops' will need to be static ttyl, --buddy |
Re: Delay Help!
Quote:
|
Re: Delay Help!
well we just downloaded the WPILib and are currently trying to get it to download into our controller. Thanks to all for your advice. We have been trying many different things and we have officially run out of ideas. We are currently waiting for our mentor to see if he has any new ideas.
|
Re: Delay Help!
Thanks to everyone for the help and expertice. We finally got it and we are well on our way. Thanks again!
|
| All times are GMT -5. The time now is 13:22. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi