Thread: Encoders
View Single Post
  #9   Spotlight this post!  
Unread 13-05-2006, 23:54
GeorgeTheEng's Avatar
GeorgeTheEng GeorgeTheEng is offline
Former Lord of the Vex
AKA: George Marchant
FRC #0087 (Red Devils)
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 2000
Location: Mount Laurel, NJ
Posts: 166
GeorgeTheEng has much to be proud ofGeorgeTheEng has much to be proud ofGeorgeTheEng has much to be proud ofGeorgeTheEng has much to be proud ofGeorgeTheEng has much to be proud ofGeorgeTheEng has much to be proud ofGeorgeTheEng has much to be proud ofGeorgeTheEng has much to be proud ofGeorgeTheEng has much to be proud ofGeorgeTheEng has much to be proud of
Send a message via AIM to GeorgeTheEng
Re: Encoders

Quote:
Originally Posted by Ctx32
Thats my problem, How do you tell the motor to go forward say 90 clicks?
Is this how: Begin - Start Encoder - Get encoder - motor module clockwise
If -encoder ==90 - stop motor.

Is this correct?
and how do you reverse it?
I'm sorry I'm really lost.
Thanks for your help.
Calvin
That is basically correct. Start the encoder when you want it to start. Inside some sort of loop, get the encoder value. Compare that to 90. If it's less, drive the motor forward. Stop it when it gets to 90 or above.

The encoders do not detect direction. So no matter what way it moves, the value will increase. Depending on how your code is set up, to reverse it, you have two choices. 1) reverse the motor direction and keep counting the encoder until it hits 180. Then stop. 2) reset the encoder and in a separate loop, do the same thing as forward, except you need to reverse the motor direction.

Try this...
create a variable, count = 0
Start Encoder
While (count <= 90)
Set motor forward
Set motor to neutral
Stop Encoder
Start Encoder
While (count <= 90)
Set motor reverse
Set motor to neutral
__________________
George Marchant - Lockheed Martin Engineer & General Nut Case
FIRST Credentials: Team 87 Mentor | Former Director FIRST Vex Challenge
NJ FIRST Planning Committee Member & NJ FVC Committee Member
Philadelphia Alliance Regional Corporate Advisory Board Member |
FRC and FTC volunteer at too many places to list (NJ, VA, DE, PA, NY, Championship)|


"Hi my name is George and I'm a FIRST-aholic. I've been a FIRST-aholic since 2000..."