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

项目: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();
    }
}
项目:wpilibj    文件:AnalogIOButton.java   
public boolean get() {
    try {
        return DriverStation.getInstance().getEnhancedIO().getAnalogIn(port) < THRESHOLD;
    } catch (EnhancedIOException ex) {
        return false;
    }
}
项目:wpilibj    文件:DigitalIOButton.java   
public boolean get(){
    try {
        return DriverStation.getInstance().getEnhancedIO().getDigital(port) == ACTIVE_STATE;
    } catch (EnhancedIOException ex) {
        return false;
    }
}
项目:Treecoil-2014    文件:DriverStationComm.java   
/**
 * Set the state of an LED on the IO board.
 * @param channel
 * @param on
 */
public static void setLED(int channel, boolean on) {
    try {
        enhancedIO.setLED(channel, on);
    }
    catch (EnhancedIOException e) {
        Logger.log(e);
    }
}
项目:FRC-2014-test    文件:DriverStationComm.java   
/**
 * Set the state of the LED lights.
 * @param channel the LED channel
 * @param on true to turn the LED on
 */
public static void setLED(int channel, boolean on) {
    try {
        driverStationIO.setLED(channel, on);
    } catch (EnhancedIOException exception) {
        Log.log(exception);
    }
}
项目:Nutrons2013    文件:OI.java   
private double getIOAnalog(int port) {
    double in;
    try {
        in = io.getAnalogIn(port);
    }
    catch(EnhancedIOException ex) {
        return 0;
    }
    double refined = capAndBand(scaleAnalog(in));
    return refined;
}
项目:Nutrons2013    文件:OI.java   
private boolean getIODigital(int port) {
    boolean in = false;
    try {
        in = !io.getDigital(port); //active low
    }
    catch(EnhancedIOException ex) {
    }
    return in;
}
项目:BadRobot2013    文件:HUD.java   
public void setLED(int index, boolean state)
{
    try
    {
        io.setLED(index, state);
    }
    catch (EnhancedIOException ex)
    {
        ex.printStackTrace();
    }
}
项目:wpilib-java    文件:AnalogIOButton.java   
public boolean get() {
    try {
        return DriverStation.getInstance().getEnhancedIO().getAnalogIn(port) < THRESHOLD;
    } catch (EnhancedIOException ex) {
        return false;
    }
}
项目:wpilib-java    文件:DigitalIOButton.java   
public boolean get(){
    try {
        return DriverStation.getInstance().getEnhancedIO().getDigital(port) == ACTIVE_STATE;
    } catch (EnhancedIOException ex) {
        return false;
    }
}
项目:2013ultimate-ascent    文件:ButtonBoard.java   
/**
 * Set the state of an LED on the driver station.
 * 
 * @param num number of LED, from 1-3
 * @param on whether or not the LED is on
 */
public void setLED(int num, boolean on) {
    if (num <= 3 && num >= 1) {
        try {
            ioBoard.setDigitalOutput(LED_PINS[num - 1], !on);
        } catch (EnhancedIOException ex) {
            ex.printStackTrace();
        }
    }
}
项目:2013ultimate-ascent    文件:ButtonBoard.java   
/**
 * Get the state of a button.
 * 
 * @param num number of button, from 1-6
 * @return true if the button is pressed, false otherwise
 */
public boolean getButtonState(int num) {
    if (num <= 6 && num > 0) {
        try {
            return !ioBoard.getDigital(BUTTON_PINS[num - 1]);
        } catch (EnhancedIOException ex) {
            ex.printStackTrace();
        }
    }

    return false;
}
项目:2013ultimate-ascent    文件:ButtonBoard.java   
/**
 * Get the state of a potentiometer.
 * 
 * @param num number of the potentiometer, from 1-6
 * @return the ratiometric turn of the potentiometer, from 0-1
 */
public double getPotentiometerState(int num) {
    if (num <= 2 && num > 0) {
        try {
            return ioBoard.getAnalogInRatio(POT_PINS[num - 1]);
        } catch (EnhancedIOException ex) {
            ex.printStackTrace();
        }
    }

    return Double.NaN;
}
项目:UltimateAscentCode    文件:JoystickButton.java   
public boolean debouncedValueDigital()
{
    try {
        //toggle logic: check to see if it's already pressed
        //System.out.println("Button State:  " + digital.get());
        //System.out.println("Button" +button+ " : " + digital.getDigital(button) + "Flag: " + flag1);

        if(!digital.getDigital(button))
        {
            if(flag1)
            {
                flag1 = false;
                //System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ RETURNING TRUE $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
                return true;
            }
        }
        else
        {
            flag1 = true;
        }

    } 
    catch (EnhancedIOException ex) 
    {
        System.out.println("FAILED");
        ex.printStackTrace();
    }
    return false;
}
项目:UltimateAscentCode    文件:JoystickButton.java   
public boolean holdButtonTimeDigital(double pauseTime)
{
    try {
        double curTime = 0.0;
        if(!digital.getDigital(button))
        {
            if(flag2)
            {
                flag2 = false;
                curTime = time.get();
            }
            else if(time.get() > curTime + pauseTime)
            {
                return true;
            }
        }
        else
        {
            time.stop();
            time.reset();
            flag2 = true;
        }

    } catch (EnhancedIOException ex) {
        ex.printStackTrace();
    }
    return false;
}
项目:UltimateAscentEnhancedButtonLogic    文件:JoystickButton.java   
public boolean debouncedValueDigital()
{
    try {
        //toggle logic: check to see if it's already pressed
        //System.out.println("Button State:  " + digital.get());
        //System.out.println("Button" +button+ " : " + digital.getDigital(button) + "Flag: " + flag1);

        if(!digital.getDigital(button))
        {
            if(flag1)
            {
                flag1 = false;
                //System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ RETURNING TRUE $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
                return true;
            }
        }
        else
        {
            flag1 = true;
        }

    } 
    catch (EnhancedIOException ex) 
    {
        System.out.println("FAILED");
        ex.printStackTrace();
    }
    return false;
}
项目:UltimateAscentEnhancedButtonLogic    文件:JoystickButton.java   
public boolean holdButtonTimeDigital(double pauseTime)
{
    try {
        double curTime = 0.0;
        if(!digital.getDigital(button))
        {
            if(flag2)
            {
                flag2 = false;
                curTime = time.get();
            }
            else if(time.get() > curTime + pauseTime)
            {
                return true;
            }
        }
        else
        {
            time.stop();
            time.reset();
            flag2 = true;
        }

    } catch (EnhancedIOException ex) {
        ex.printStackTrace();
    }
    return false;
}
项目:grtframeworkv7    文件:ButtonBoard.java   
/**
 * Set the state of an LED on the driver station.
 * 
 * @param num number of LED, from 1-3
 * @param on whether or not the LED is on
 */
public void setLED(int num, boolean on) {
    if (num <= 3 && num >= 1) {
        try {
            ioBoard.setDigitalOutput(LED_PINS[num - 1], !on);
        } catch (EnhancedIOException ex) {
            ex.printStackTrace();
        }
    }
}
项目:grtframeworkv7    文件:ButtonBoard.java   
/**
 * Get the state of a button.
 * 
 * @param num number of button, from 1-6
 * @return true if the button is pressed, false otherwise
 */
public boolean getButtonState(int num) {
    if (num <= 6 && num > 0) {
        try {
            return !ioBoard.getDigital(BUTTON_PINS[num - 1]);
        } catch (EnhancedIOException ex) {
            ex.printStackTrace();
        }
    }

    return false;
}
项目:grtframeworkv7    文件:ButtonBoard.java   
/**
 * Get the state of a potentiometer.
 * 
 * @param num number of the potentiometer, from 1-6
 * @return the ratiometric turn of the potentiometer, from 0-1
 */
public double getPotentiometerState(int num) {
    if (num <= 2 && num > 0) {
        try {
            return ioBoard.getAnalogInRatio(POT_PINS[num - 1]);
        } catch (EnhancedIOException ex) {
            ex.printStackTrace();
        }
    }

    return Double.NaN;
}
项目:Nutrons2013    文件:OI.java   
public boolean getDriveQuickTurn() throws EnhancedIOException {
    return getIODigital(3);
}
项目:Nutrons2013    文件:DTManualCheesyCmd.java   
protected void execute() {
    try {
        dt.driveCheesy(oi.getDriveThrottle(), oi.getDriveWheel(), oi.getDriveQuickTurn());
    } catch (EnhancedIOException ex) {
    }
}