Hey,
I've got two switches connected up to our team's Cypress board and I wanted one switch if it was false to be able to make the robot drive with joystick, but if it was true I wanted it to photo sense.
Code:
while (isOperatorControl()) {
gyro.setSensitivity(0.125);
dsLCD.updateLCD();
if (GyroAngle >= 360 || GyroAngle <= -360) {
GyroAngle = GyroAngle % 360;
}
updateDashboard();
PVal = (int) ((petOm.getVoltage()) * 10);
dsLCD.println(DriverStationLCD.Line.kMain6, 1, "Arm Angle " + PVal);
dsLCD.println(DriverStationLCD.Line.kUser2, 1, "Light " + light.getAverageValue());
dsLCD.println(DriverStationLCD.Line.kUser3, 1, "Gyro Angle " + GyroAngle);
ds = DriverStation.getInstance();
if (ds.getDigitalIn(1)) {
photosense(rite, left, middle);
ds = DriverStation.getInstance();
}
else
{
if (ds.getDigitalIn(3)) {
FullSpeed(r1, r2, l1, l2, rightStick);
ds = DriverStation.getInstance();
}
if (!ds.getDigitalIn(3)) {
HalfSpeed(r1, r2, l1, l2, rightStick);
ds = DriverStation.getInstance();
}
ds = DriverStation.getInstance();
}
}