![]() |
Delay Function
Can someone show me a way to write a function that can delay the robot. I would like to write a function and put it in ‘user_routines.c’ and call it anywhere in my ‘user_routines_fast.c’ file. Simply I would like to:
{ pwm13 = 167; pwm15 = 167; delay = 100; } where ‘delay =’ would pause the robot for whatever time you gave it. Your help would be appreciated. What would the function look like? Thanks... |
Re: Delay Function
maybe somthing like this..
Code:
void delay(unsigned int seconds) |
Re: Delay Function
"Stalling" execution is generally a bad idea. I would make a "loopcounter" variable, and increase the counter every time the function runs. After a certain number of loops, make it do the next thing.
For example, here's our pump code: Code:
void pump_routine(void) { |
Re: Delay Function
i've thought about it before, and it turns out something like bear24rw's idea.
Code:
int counter=0; |
Re: Delay Function
Quote:
Perhaps you will find some insight in this recent thread I'd suggest structuring your autonomous code to run every 26ms (off the SPI data updates), tuck some timers into that, and structure you code as a state machine. |
Re: Delay Function
Quote:
|
Re: Delay Function
Quote:
|
| All times are GMT -5. The time now is 04:53. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi