View Single Post
  #2   Spotlight this post!  
Unread 20-02-2012, 10:58
sjspry sjspry is offline
Registered User
FRC #1984
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Kansas
Posts: 125
sjspry has a spectacular aura aboutsjspry has a spectacular aura aboutsjspry has a spectacular aura about
Re: Potentiometer and analogue channels

If the code says it was enabled somewhere, it was enabled somewhere (I think the channel used to read the battery voltage is exposed on the header pins - you might be trying to use it).

However, since that exception throwing is mostly to keep you from mixing up what you are using channels for (if, for example, you happen to double-allocate a channel), you can bypass it and get the reading for that channel number with:

Code:
AnalogModule.getInstance(slot).getVoltage(chan);
Optionally storing the instance of the AnalogModule in your own variable.
Reply With Quote