View Single Post
  #2   Spotlight this post!  
Unread 30-01-2010, 09:42
bjrussell bjrussell is offline
Registered User
FRC #1111 (Powerhawks)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Edgewater, MD
Posts: 1
bjrussell is an unknown quantity at this point
Re: EnhancedIO Exception Error

Well, it's been a little while since I did Java, but I would guess that the getAnalogIn function can throw an exception, and it's not being handled. You either need a try block around it or you need to declare that it can throw the exception.

Solution 1 (in method):
try {
double slider = dseio.getAnalogIn(1);
//additional code to execute if that works
}
catch (IOException ioexec) {
//do stuff here if it goes wrong
}
(this last part may or may not be necessary; just know that it will always execute, even if an exception is thrown)
finally {
//more stuff that will always execute
}

Solution 2:
public void teleopPeriodic() throws EnhancedIOException {
double slider = dseio.getAnalogIn(1);
}

Solution 1 has much better control over what happens if an exception is thrown, so I suggest you use that one in your program. I hope it works for you.
Reply With Quote