Java 类edu.wpi.first.wpilibj.DriverStationEnhancedIO 实例源码

项目:HyperionRobot2014    文件:LedsSetter.java   
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);
    }

}
项目:2013ultimate-ascent    文件:ButtonBoard.java   
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();
    }
}
项目:grtframeworkv7    文件:ButtonBoard.java   
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();
    }
}
项目:FRC623Robot2014    文件:Robot623.java   
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();
    }
}
项目:2014-Krugelfang    文件:Controls.java   
public static void Init(DriverStationEnhancedIO driverStation) {
    Controls.driverStation = driverStation;
}
项目:HyperionRobot2014    文件:LedsSetter.java   
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);           
    }
}