|
Re: autonomous timing
Do not use while loops.
Remember, the code loops already. Simply increment the counter each loop and have an if / then statement to do whatever when it reaches the loop count that you want.
count++;
if (count <= 10)
{
pwm01=200;
pwm02=254;
}
else if ((count >=10) && (count <= 50))
{
pwm01=254;
pwm02=254;
}
Technically speaking you don't need the count >= 10 in else if because it won't make it there if the count IS less than 10 - it will do the first if then kick out. But I have the guys I work with do it that way for clarity's sake.
|