Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.usfirst.frc.team469.robot;
- import com.ctre.CANTalon;
- import edu.wpi.first.wpilibj.IterativeRobot;
- import com.ctre.CANTalon.FeedbackDevice;
- import com.ctre.CANTalon.TalonControlMode;
- public class SampleTalonSRX extends IterativeRobot {
- CANTalon _talon = new CANTalon(0);
- public void robotInit() {
- /* first choose the sensor */
- _talon.setFeedbackDevice(FeedbackDevice.CtreMagEncoder_Relative);
- _talon.reverseSensor(false);
- /* set the peak and nominal outputs, 12V means full */
- _talon.configNominalOutputVoltage(+0.0 f, -0.0 f);
- _talon.configPeakOutputVoltage(+12.0 f, -12.0 f);
- /* set closed loop gains in slot0 */
- _talon.setProfile(0);
- _talon.setF(0.1097);
- _talon.setP(0.22);
- _talon.setI(0);
- _talon.setD(0);
- }
- public void teleopPeriodic() {
- _talon.changeControlMode(TalonControlMode.Speed);
- _talon.set(1500); /* 1500 RPM in either direction */
- }
Add Comment
Please, Sign In to add comment