示例#1
0
  /**
   * 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
    }
  }
示例#2
0
 /**
  * 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;
   }
 }
示例#3
0
 // For debugging purposes.
 public boolean getDigitalValue(int channel) {
   boolean b = false;
   try {
     b = !enhancedIO.getDigital(channel);
   } catch (EnhancedIOException e) {
   }
   return b;
 }
示例#4
0
文件: OI.java 项目: Team1065/FRC-2013
 public boolean getNandoSwitch() throws EnhancedIOException {
   return ds.getDigital(5);
 }
示例#5
0
文件: OI.java 项目: Team1065/FRC-2013
 public boolean getAngleSwitch() throws EnhancedIOException {
   return ds.getDigital(2);
 }
示例#6
0
文件: OI.java 项目: Team1065/FRC-2013
 public boolean getCompressorSwitch() throws EnhancedIOException {
   return ds.getDigital(1);
 }
示例#7
0
文件: OI.java 项目: Team1065/FRC-2013
 public boolean getAutoRight() throws EnhancedIOException {
   return ds.getDigital(7);
 }
示例#8
0
文件: OI.java 项目: Team1065/FRC-2013
 public boolean getAutoLeft() throws EnhancedIOException {
   return ds.getDigital(3);
 }
示例#9
0
文件: OI.java 项目: Team1065/FRC-2013
 public boolean getDisckLockButton() throws EnhancedIOException {
   return ds.getDigital(8);
 }