View Single Post
  #7   Spotlight this post!  
Unread 26-01-2004, 23:21
LoyolaCubs LoyolaCubs is offline
Registered User
#1453
 
Join Date: Jan 2004
Location: Los Angeles
Posts: 3
LoyolaCubs is an unknown quantity at this point
Re: problems assigning unsigned chars in FRC Code

Thanks all for your help. I got the autonomous dead reckoning working. Now I better move on to the harder stuff...

Btw, I learned that while loops in the Drive_Forward function are a bad idea. The counter should really be added to in the main loop that takes 26.2 ms. If you throw a while loop in the Drive_Forward function, the loop can take too long and anger the main program. Therefore, we have something like this:

void Drive_Forward()
{
pwm01 = 254;
pwm02 = 254;
}

Then down in the main loop:

{//loopy part
...
counter++;

if( counter < 100 && counter >= 50 )
{
Drive_Forward();
}
...
}

Eventually, we will use a timer rather than a counter to time movements. This is one reason C is so much more powerful than PBASIC. Anyway, I hope this lesson we learned helps you.