Thread: Encoder Help
View Single Post
  #1   Spotlight this post!  
Unread 25-01-2011, 16:35
normpearii normpearii is offline
Fledgling Programmer
AKA: Norman Pearson II
FRC #2603 (Highland Robotics Team)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Medina, Ohio
Posts: 6
normpearii is an unknown quantity at this point
Send a message via ICQ to normpearii Send a message via AIM to normpearii Send a message via MSN to normpearii Send a message via Yahoo to normpearii
Encoder Help

We are having trouble getting our motors to go forward for 10 ticks of our encoders; this is how we are testing out encoder code to make sure it works.

MyRobot.cpp (Simple Template)
Our Declaration
Code:
Encoder encoderR;
Encoder encoderL;
double dblRight;
Our Init
Code:
encoderR(13,12),
encoderL(10,11)
Our Autonomous drive code
Code:
encoderR.Start();
encoderL.Start();
dblRight=encoderR.GetDistance();

if(dblRight>-10)
{
myRobot.Drive(0.5, 0.0); 	
dblRight=encoderR.GetDistance();
}
 				
else if(dblRight<=-10)
{
myRobot.Drive(0.0, 0.0); 	
dblRight=encoderR.GetDistance();
}
Reply With Quote