|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Code error with while loops??
-History-
I am a student who is currently learning C++, so I know simple commands like a while statement. I was able to get this code working when I program a PC. I searched the web for help but found nothing ----================== Now when I program the Robot using C I get it to do a loop but after a few times the bot will say code error. I just want the robot to travel for a certain number of seconds. here is my code what is wrong? or is there a better way to have a robot on a timer? (this code is under the void Autonomous(void) function) if(stop == 0) { timer = 900; while(timer > 0) { timer = timer - 1; printf( "timer is %d\n", timer ); pwm13 = pwm14 = pwm15 = pwm16 = 255; } stop = 1; // this should make sure the code wont run again } printf( "stop is %d\n", stop ); pwm13 = pwm14 = pwm15 = pwm16 = 127; printf( "pwm13 is %d\n", pwm13 ); Last edited by Lakeeffect1674 : 08-03-2008 at 11:04. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| "Code Error" with RegisterRepeatingTimer | d235j | Programming | 4 | 27-02-2008 21:51 |
| Error in code light on, trouble finding error | Bryan Herbst | Programming | 16 | 12-10-2007 21:59 |
| While loops | Guy_E | VEX | 6 | 01-11-2006 22:04 |
| Moving robot while tracking with camera questions... | Steve Orr | Programming | 6 | 02-02-2006 22:24 |
| Code error on RC after downloading "bells and whistles" version of Kevins camera code | DanDon | Programming | 6 | 10-01-2006 18:07 |