public void SetBumpersColor(){ double ColorValue = 0; try { ColorValue = DriverStation.getInstance().getEnhancedIO().getAnalogIn(6); } catch (DriverStationEnhancedIO.EnhancedIOException ex) { ex.printStackTrace(); } if(ColorValue > 1.5){ ColorLedsRelay.set(Relay.Value.kForward); } else{ ColorLedsRelay.set(Relay.Value.kReverse); } }
private ButtonBoard() { super("Button Board", 8); try { for (int i = 0; i < BUTTON_PINS.length; i++) ioBoard.setDigitalConfig(BUTTON_PINS[i], DriverStationEnhancedIO.tDigitalConfig.kInputPullUp); for (int i = 0; i < LED_PINS.length; i++) { ioBoard.setDigitalConfig(LED_PINS[i], DriverStationEnhancedIO.tDigitalConfig.kOutput); ioBoard.setDigitalOutput(LED_PINS[i], true); } } catch (EnhancedIOException ex) { ex.printStackTrace(); } }
private void processImage() throws Exception { DriverStationEnhancedIO dseio; dseio = DriverStation.getInstance().getEnhancedIO(); if (imagePressed && !dseio.getDigital(1)) { imagePressed = false; } if (!imagePressed && dseio.getDigital(1)) { printToDash(2, "WOO"); imagePressed = true; visControl.processImage(); } }
public static void Init(DriverStationEnhancedIO driverStation) { Controls.driverStation = driverStation; }
public void FlashLedsPeriodic(){ double flashTimeMs = 1; try { flashTimeMs = DriverStation.getInstance().getEnhancedIO().getAnalogIn(8) * 1000; if(flashTimeMs > 2500){ flashTimeMs = 10000000; } } catch (DriverStationEnhancedIO.EnhancedIOException ex) { ex.printStackTrace(); } //System.out.println("FlashTime" + flashTimeMs); if ((System.currentTimeMillis() - LastFlashTimeMs) > flashTimeMs){ // Initiate FLASH; m_FlashState = false; LastFlashTimeMs = System.currentTimeMillis(); } else if ((System.currentTimeMillis() - LastFlashTimeMs) > (0.1 * flashTimeMs)) { m_FlashState = true; } if (m_FlashState) { if (!m_bIsError) { FlashingLedsRelay.set(Relay.Value.kForward); } else { FlashingLedsRelay.set(Relay.Value.kReverse); } } else { FlashingLedsRelay.set(Relay.Value.kOn); } }