Go to Post After all, bitterness takes all the fun out of wiring. - Venkatesh [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 08-03-2008, 11:02
Lakeeffect1674 Lakeeffect1674 is offline
Registered User
FRC #1674
 
Join Date: Jan 2007
Location: Onekama, Michigan
Posts: 18
Lakeeffect1674 is an unknown quantity at this point
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
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 20:21.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi