Thread: encoders
View Single Post
  #2   Spotlight this post!  
Unread 12-01-2005, 15:19
seanwitte seanwitte is offline
Registered User
None #0116
Team Role: Engineer
 
Join Date: Nov 2002
Location: Herndon, VA
Posts: 378
seanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant future
Send a message via AIM to seanwitte
Re: encoders

What does the robot do when you move the joystick? Have you tried turning the encoder by hand and printing the value of lec to make sure its being incremented correctly?

Since the call to Get_Left_Encoder_Count() does not reset the internal value, your local variable (lec) will saturate very quickly. Once the encoder moves one tick it will increment lec over 12 almost instantly. You either need to reset the value to 0 or use Get_Left_Encoder_Count() on its own as your counter.
Code:
     if (Get_Left_Encoder_Count() >= 12)    
     {
          pwm02 = 127;
     }
     {
          pwm02 = p3_y;
     }

Last edited by seanwitte : 12-01-2005 at 15:38.