Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   FIRST Tech Challenge (http://www.chiefdelphi.com/forums/forumdisplay.php?f=146)
-   -   [FTC]: Encoders (http://www.chiefdelphi.com/forums/showthread.php?t=74865)

astephen68 17-02-2009 23:03

[FTC]: Encoders
 
Does anybody have any sample code for encoders that i can take a look at. Thanks if you do.

gdo 18-02-2009 08:43

Re: [FTC]: Encoders
 
Which language?

If you are using RobotC, this will work

Quote:

nMotorEncoder[YOUR_MOTOR1_HERE] = 0;
nMotorEncoder[YOUR_MOTOR2_HERE] = 0;
nMotorEncoderTarget[YOUR_MOTOR1_HERE] = X_Distance;
nMotorEncoderTarget[YOUR_MOTOR2_HERE] = X_Distance;
motor[YOUR_MOTOR1_HERE] = 100;
motor[YOUR_MOTOR2_HERE] = 100;
Just substitute "YOUR_MOTOR1_HERE" and "YOUR_MOTOR2_HERE" for the names of the motors you are using, and then substitute "X_Distance" for the number of rotations you want to travel.

ttldomination 18-02-2009 12:32

Re: [FTC]: Encoders
 
I don't think you need to do the motor[motorname] = 100;, I think the encoders already go to the target encoder positions.

Is that right?

ShawnH 18-02-2009 12:36

Re: [FTC]: Encoders
 
You still need to motor[motorname] = 100;. nMotorEncoderTarget[] does not move the motor. It only set the target.

ttldomination 18-02-2009 15:19

Re: [FTC]: Encoders
 
Oh..really...what happens when the encoders reach the target position?

ShawnH 18-02-2009 16:32

Re: [FTC]: Encoders
 
The motors should just stop.

astephen68 18-02-2009 22:43

Re: [FTC]: Encoders
 
I want to know how to use encoders on an arm in and out of autonomous. I have gotten it to go up but its not reconizing a second button in robotc what should i do

gdo 19-02-2009 09:53

Re: [FTC]: Encoders
 
Can you post what code you have so far?


All times are GMT -5. The time now is 18:03.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi