View Single Post
  #4   Spotlight this post!  
Unread 19-01-2016, 07:26
christheman200's Avatar
christheman200 christheman200 is offline
Chris Lansdale, Programmer
AKA: Chris Lansdale
FRC #0854 (Iron Bears)
Team Role: Programmer
 
Join Date: Mar 2015
Rookie Year: 2014
Location: Toronto, Ontario
Posts: 31
christheman200 is an unknown quantity at this point
Re: Unable to invert motor

Here's the rest of the code. I've tried the fixes mentioned above, but they haven't seemed to help.
Code:
package org.usfirst.frc.team854.robot;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Talon;

/**
 * The VM is configured to automatically run this class, and to call the
 * functions corresponding to each mode, as described in the IterativeRobot
 * documentation. If you change the name of this class or the package after
 * creating this project, you must also update the manifest file in the resource
 * directory.
 */
public class Robot extends IterativeRobot {
	
	Joystick driveStick1 = new Joystick(1);
	Joystick driveStick2 = new Joystick(2);
	RobotDrive MainDrive = new RobotDrive(0,1);
	
	MainDrive.setInvertedMotor(Talon.kRearLeft, true); 
	MainDrive.setInvertedMotor(Talon.kRearRight, true);
	
	Talon lifter = new Talon(3);
	
	float lifterSpeed = 1.0f; //f for float (to have decimals!)
	
    /**
     * This function is run when the robot is first started up and should be
     * used for any initialization code.
     */
    public void robotInit() {
    	
    }

    /**
     * This function is called periodically during autonomous
     */
    public void autonomousPeriodic() {

    }

    /**
     * This function is called periodically during operator control
     */
    public void teleopPeriodic() {
        MainDrive.tankDrive(driveStick1, driveStick2);
        
        
        if(driveStick2.getRawButton(3))
        	lifter.set(lifterSpeed);
        else if(driveStick2.getRawButton(5))
        	lifter.set(-lifterSpeed);
        else
        	lifter.set(0.0);
        
    }

	/**
     * This function is called periodically during test mode
     */
    public void testPeriodic() {
    
    }
    
}
Reply With Quote