|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#7
|
|||
|
|||
|
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. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| FRC default code | hedgehogger | Programming | 2 | 21-01-2004 18:41 |
| Problem with FRC Default code | AsimC | Programming | 2 | 11-01-2004 19:22 |
| ADC problems with C library and new code | Larry Barello | Programming | 1 | 09-01-2004 22:31 |