Quote:
|
Originally Posted by bush
If we had an analog input device hooked up to Analog Input Port 1, what would the value rc_ana_in01 represent? Is it the voltage? Or possibly (Voltage * 1024 / 5)?
|
rc_ana_in01 is a constant that you pass to GetAnalogValue in order
to read the corresponding analog input.
For example:
int analogvaluefrominput01;
analogvaluefrominput01 = GetAnalogValue(rc_ana_in01);
The resulting value stored in the int variable has the range 0 to 1023
0 corresponds to roughly zero volts, and 1023 corresponds to roughly
5 volts. Your equation reflects that.
Edit: The analog inputs on the RC look at voltage. When a POT is
hooked up to one these inputs it is wired as a voltage divider for a
5 volt supply. The analog inputs on the OI have a different range,
0 to 255(254), and are set up to jump to 127 in the event that 0 volts is
applied (or the circuit opens), for safety reasons.
Eugene