/** * Use a thumb wheel switch to set the autonomous mode setting. * * @return Autonomous setting to run. */ public int getAutonSetting() { try { int switchNum = 0; int[] binaryValue = new int[3]; boolean[] dIO = { !enhancedIO.getDigital(BIT_1_CHANNEL), !enhancedIO.getDigital(BIT_2_CHANNEL), !enhancedIO.getDigital(BIT_3_CHANNEL) }; for (int i = 0; i < 3; i++) { if (dIO[i]) { binaryValue[i] = 1; } else { binaryValue[i] = 0; } } binaryValue[0] *= 4; // convert all binaryValues to decimal values binaryValue[1] *= 2; for (int i = 0; i < 3; i++) { // finish binary -> decimal conversion switchNum += binaryValue[i]; } return switchNum; } catch (EnhancedIOException e) { return -1; // Do nothing in case of failure } }
/** * Gets value of hoop height toggle switch. * * @return true if high setting, false if middle */ public boolean getStingerSwitch() { try { return !enhancedIO.getDigital(STINGER_SWITCH_CHANNEL); } catch (EnhancedIOException ex) { return true; } }
// For debugging purposes. public boolean getDigitalValue(int channel) { boolean b = false; try { b = !enhancedIO.getDigital(channel); } catch (EnhancedIOException e) { } return b; }
public boolean getNandoSwitch() throws EnhancedIOException { return ds.getDigital(5); }
public boolean getAngleSwitch() throws EnhancedIOException { return ds.getDigital(2); }
public boolean getCompressorSwitch() throws EnhancedIOException { return ds.getDigital(1); }
public boolean getAutoRight() throws EnhancedIOException { return ds.getDigital(7); }
public boolean getAutoLeft() throws EnhancedIOException { return ds.getDigital(3); }
public boolean getDisckLockButton() throws EnhancedIOException { return ds.getDigital(8); }