Created
January 23, 2013 11:57
-
-
Save nimdahk/4604772 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Joystick stick; | |
Jaguar wheel1; | |
Jaguar wheel2; | |
double wheel1Speed; | |
double wheel2Speed; | |
boolean b2, b3, b4, b5; | |
final double INC1 = 0.03; | |
final double INC2 = 0.03; | |
public void robotInit() { | |
print1("robotInit()"); | |
stick = new Joystick(1); | |
wheel1 = new Jaguar(1); | |
wheel2 = new Jaguar(2); | |
wheel1Speed = 0; wheel2Speed = 0; | |
} | |
/** | |
* This function is called periodically during autonomous | |
*/ | |
public void autonomousPeriodic() { | |
} | |
/** | |
* This function is called periodically during operator control | |
*/ | |
public void teleopPeriodic() { | |
print1("teleopPeriodic()"); | |
if (stick.getRawButton(3)){ | |
print2("b3 down"); | |
b3 = true; | |
}else if (b3){ | |
wheel1Speed += INC1; | |
wheel1.set(wheel1Speed); | |
b3 = false; | |
} | |
if (stick.getRawButton(2)){ | |
print2("b2 down"); | |
b2 = true; | |
}else if (b2){ | |
wheel1Speed -= INC1; | |
wheel1.set(wheel1Speed); | |
b2 = false; | |
} | |
if (stick.getRawButton(4)){ | |
print2("b4 down"); | |
b4 = true; | |
}else if (b4){ | |
wheel2Speed += INC2; | |
wheel2.set(wheel2Speed); | |
b4 = false; | |
} | |
if (stick.getRawButton(5)){ | |
print2("b5 down"); | |
b5 = true; | |
}else if (b5){ | |
wheel2Speed -= INC2; | |
wheel2.set(wheel2Speed); | |
b5 = false; | |
} | |
if (stick.getRawButton(9)){ | |
wheel1.set(0); wheel2.set(0); | |
wheel1Speed = 0; wheel2Speed = 0; | |
print3(" "); | |
print4(" "); | |
} | |
print3(wheel1.get() + ""); | |
print4(wheel2.get() + ""); | |
} | |
public void print1(String s){ | |
DriverStationLCD.getInstance().println(DriverStationLCD.Line.kUser1, 1, s); | |
DriverStationLCD.getInstance().updateLCD(); | |
} | |
public void print2(String s){ | |
DriverStationLCD.getInstance().println(DriverStationLCD.Line.kUser2, 1, s); | |
DriverStationLCD.getInstance().updateLCD(); | |
} | |
public void print3(String s){ | |
DriverStationLCD.getInstance().println(DriverStationLCD.Line.kUser3, 1, s); | |
DriverStationLCD.getInstance().updateLCD(); | |
} | |
public void print4(String s){ | |
DriverStationLCD.getInstance().println(DriverStationLCD.Line.kUser4, 1, s); | |
DriverStationLCD.getInstance().updateLCD(); | |
} | |
/** | |
* This function is called periodically during test mode | |
*/ | |
public void testPeriodic() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment