View Single Post
  #2   Spotlight this post!  
Unread 03-08-2010, 22:15
Foster Foster is offline
Engineering Program Management
VRC #8081 (STEMRobotics)
Team Role: Mentor
 
Join Date: Jul 2007
Rookie Year: 2005
Location: Delaware
Posts: 1,392
Foster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond repute
Re: Delay10KTCYx in C18

Your code is in the middle of a loop that NEEDS to get data every 18.5ms and return back a I'm alive message. If you wait for 5 seconds the master CPU is going to think there is a problem and reset the slave.

What you want to do is count the number of times you've been through the loop and when it's been 5 seconds (5 sec / 18.5 ms) then set the PWM values.

autoseconds = autoseconds + 185;

If autoseconds > 5000 then pwm = 127.
__________________
Foster - VEX Delaware - 17 teams -- Chief Roboteer STEMRobotics.org
2010 - Mentor of the Year - VEX Clean Sweep World Championship
2006-2016, a decade of doing VEX, time really flies while having fun
Downingtown Area Robotics Web site and VEXMen Team Site come see what we can do for you.