View Single Post
  #8   Spotlight this post!  
Unread 01-01-2004, 21:27
Anthony Kesich's Avatar
Anthony Kesich Anthony Kesich is offline
Programmer Turned Engineer
AKA: SonKenshin
#1097 (Site 3 Engineernig)
Team Role: Leadership
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Sacramento, CA
Posts: 186
Anthony Kesich has a spectacular aura aboutAnthony Kesich has a spectacular aura about
Send a message via AIM to Anthony Kesich
Re: hey need some help with writing a code please help me here

Code:
char turning=0;  //in the global vars section

if (BUMP_SENSOR)   //if hit wall set turning timer
   turning=40;
if (turning >= 35)   //back up first 6 cycles or so to give clearance
{
   pwm01=pwm02=70;
   turning--;
}
else if (turning)   //turn for the remaining time
{
   pwm01=77;     //assuming 2 motor drive train here
   pwm02=187;    //adjust values as necessary such as time needed to turn and turning speed
   turning--;
}
else
   pwm01=pwm02=200;  //if not turning or hitting go forward 

pwm02=254-pwm02;  /*put this somewhere at the end of your user routines
                     so that it needs not be redone ater every segment of your code*/
__________________
C is screwing up my English--I'm ending all my sentences in semi-colons;

Horray for most things! -George Carlin

"Sure, I'll play rugby. Besides, I have a lot of experience running from really big guys who want to cream me." -Me, Freshman year