We are trying to read a potentiometer connected to our Cypress IO board using the enhancedIO class.
Here is our code so far:
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.AnalogChannel;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.DriverStationEnhancedIO;
import edu.wpi.first.wpilibj.DriverStation;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the IterativeRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the manifest file in the resource
* directory.
*/
public class Team503Robot extends IterativeRobot {
private RobotDrive drivetrain;
private Joystick gamepad;
private Encoder leftDriveEncoder;
private Encoder rightDriveEncoder;
private AnalogChannel potentiometer;
private DigitalInput limitSwitch;
DriverStationEnhancedIO dseio;
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
dseio = DriverStation.getInstance().getEnhancedIO();
}
/**
* This function is called periodically during autonomous
*/
public void autonomousPeriodic() {
}
/**
* This function is called periodically during operator control
*/
public void teleopPeriodic() {
double slider = dseio.getAnalogIn(1);
}
}
We get an “unreported exception edu.wpi.first.wpilibj.DriverStationEnhancedIO.EnhancedIOException; must be caught or declared to be thrown” error from the "double slider = dseio.getAnalogIn(1); line. Any help would be appreciated.