View Single Post
  #1   Spotlight this post!  
Unread 06-02-2006, 20:36
railerobotics's Avatar
railerobotics railerobotics is offline
Registered User
FRC #0935
 
Join Date: Jan 2006
Location: Newton, KS
Posts: 190
railerobotics will become famous soon enough
Autonomous problem

I have written this for atonomous code but the the robot does not stop when the counter reaches 2000. Anyone know why?

/* Add your own autonomous code here. */
switch (Step)
{
case 1:
{
stop = 2000;
crawl = (stop - 200);
slow = (stop - 100);

Left_Count = Get_Left_Encoder_Count();
Right_Count = Get_Right_Encoder_Count();
if (Left_Count < slow)
pwm03 = 220;
if (Left_Count > slow && Left_Count < crawl)
pwm03 =200;
if (Left_Count > crawl && Left_Count < stop)
pwm03 =150;
if (Left_Count >= stop)
pwm03 =127;
printf("Left Counter %ld\r", Left_Count);

if (Right_Count < slow)
pwm04 =220;
if (Right_Count > slow && Right_Count < crawl)
pwm04 =200;
if (Left_Count > crawl && Right_Count < stop)
pwm04 =150;
if (Right_Count >= stop)
pwm04 =127;
printf("Right Counter %ld\r", Right_Count);