User Manual

static int readBatteryMillivolts_SV()
int read_battery_millivolts_sv()
Performs ten 10-bit analog-to-digital conversions on the battery voltage sensing circuit (a 1/3 voltage divider
of VIN) of the Orangutan SV and returns the average measured battery voltage in millivolts. A result of 9153
would mean a battery voltage of 9.153 V. This function will only return the correct result when there is a short
across the “ADC6=VBAT/3” SMT jumper on the bottom side of the PCB. The SV ships with this SMT jumper
shorted with a solder bridge, so this function will return the correct result by default. Note that this function
performs 10-bit conversions regardless of the analog mode, but it restores the analog mode to its previous state
before the function returns.
static int readBatteryMillivolts_SVP()
int read_battery_millivolts_svp()
Returns the measured Orangutan SVP battery voltage in millivolts. The battery voltage on the SVP is
measured by the auxiliary microcontroller, so this function just asks the auxiliary MCU for the most recent
measurement; it does not use the ADC on the user MCU.
static int readBatteryMillivolts_X2()
int read_battery_millivolts_x2()
Performs ten 10-bit analog-to-digital conversions on the battery voltage sensing circuit (a 5/16 voltage divider
of VIN) of the Orangutan X2 and returns the average measured battery voltage in millivolts. A result of 9153
would mean a battery voltage of 9.153 V. This function will only return the correct result when there is a
short across the “ADC6=BATLEV” SMT jumper on the bottom side of the PCB. The X2 ships with this SMT
jumper shorted with a solder bridge, so this function will return the correct result by default. Note that this
function performs 10-bit conversions regardless of the analog mode, but it restores the analog mode to its
previous state before the function returns.
static int OrangutanAnalog::readTemperatureF()
int read_temperature_f()
Performs 20 10-bit analog-to-digital conversions on the output of the temperature sensor on the Orangutan LV
and returns average result in tenths of a degree Farenheit, so a result of 827 would mean a temperature of 82.7
degrees F. The temperature sensor is on analog input 6 on the Orangutan LV, so this method is equivalent to
readAverage(TEMP_SENSOR, 20) converted to tenths of a degree F. This function will only return the correct
result when there is a short across the “ADC6=TEMP” SMT jumper on the bottom side of the Orangutan
LV PCB. The LV ships with this SMT jumper shorted with a solder bridge, so this function will return the
correct result by default. Note that this function performs 10-bit conversions regardless of the analog mode,
but it restores the analog mode to its previous state before the function returns. Only the Orangutan LV has an
external temperature sensor, so this function will only return correct results when used on an Orangutan LV.
static int readTemperatureC()
int read_temperature_c()
This method is the same as readTemperatureF() above, except that it returns the temperature in tenths of a
degree Celcius. This function will only return correct results when used on an Orangutan LV, and it requires a
short across the “ADC6=TEMP” SMT jumper (this short is present by default).
static void OrangutanAnalog::startConversion(unsigned char channel)
void start_analog_conversion(unsigned char channel)
Initiates an ADC conversion that runs in the background, allowing the CPU to perform other tasks while
the conversion is in progress. The channel argument should be a channel number or keyword from the
appropriate table above. The procedure is to start a conversion on an analog input with this method, then poll
is_converting() in your main loop. Once is_converting() returns a zero, the result can be obtained through a
Pololu AVR Library Command Reference © 2001–2015 Pololu Corporation
2. Orangutan Analog-to-Digital Conversion Page 11 of 65