Thread: encoders
View Single Post
  #5   Spotlight this post!  
Unread 12-01-2005, 15:36
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,187
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: encoders

Since the encoder may have ticked before you hit this block of code, you may want to do something like this.

Code:
//define a variable outside the loop called 'temp1'

if(temp1==0)
{
     temp1=Get_Left_Encoder_Count();
}

static long lec = Get_Left_Encoder_Count() - temp1;

if (lec >= 12)
	{
	pwm02 = 127;		//set it to neutral
	}
	else
	{
	pwm02 = p3_y;
	}

Last edited by Tom Bottiglieri : 12-01-2005 at 15:41.