View Full Version : Potentiometers in Java
Our team is trying to find a way to measure the position of our arm using a potentiometer. We're using Java this year and we can't find any classes that are for potentiometers.
Does anyone know the best way that we could program a potentiometer in Java to give us its position?
Our team is trying to find a way to measure the position of our arm using a potentiometer. We're using Java this year and we can't find any classes that are for potentiometers.
Does anyone know the best way that we could program a potentiometer in Java to give us its position?
I think you can use analog channel
I think you can use analog channel
Awesome, thanks, I assume you mean the AnalogChannel class (there are a few others like AnalogModule, AnalogTrigger, etc.).
Would we use getVoltage() or getValue()? It might be getVoltage() since (I think) potentiometers just limit the voltage when the knob is turned. I've never used potentiometers before, though.
It shouldn't matter, you will just obtain different values. getValue will be something more akin to a "percent" (but in a range of integral values), while getVoltage will be un-scaled to be a voltage.
IIRC, getValue will give you more resolution, but overall it won't matter.
OK, we'll just pick one and go with it in the code. Thanks for your help.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.