View Single Post
  #4   Spotlight this post!  
Unread 14-02-2011, 01:32
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Encoders in Auto Mode

Still, there are many variations of using encoders. For example, do you care uisng PID? How many encoders do you have? One for left wheel and one for right wheel? Do you have mecanum wheels? In the simplest, your code should look something like this:
Code:
In some periodic function or in a loop:
if ((leftEncoder->GetDistance() + rightEncoder->GetDistance()) /2 < targetDistance)
{
    ArcadeDrive(0.5, 0.0);
}
else
{
    ArcadeDrive(0.0, 0.0);
}
__________________
Reply With Quote