User Manual

call to analog_conversion_result() or analog_conversion_result_millivolts() and this method can be used to
start a new conversion. This function does not alter the I/O state of the analog pin that corresponds to the
specified ADC channel.
static unsigned char OrangutanAnalog::isConverting()
unsigned char analog_is_converting()
Returns a 1 if the ADC is in the middle of performing an analog-to-digital conversion, otherwise it returns a
0. The AVR is only capable of performing one conversion at a time.
static unsigned int conversionResult()
unsigned int analog_conversion_result()
Returns the result of the previous analog-to-digital conversion. In 8-bit mode, the result will range from 0 to
255 for voltages from 0 to 5 V. In 10-bit mode, the result will range from 0 to 1023 for voltages from 0 to 5 V.
static unsigned int conversionResultMillivolts()
unsigned int analog_conversion_result_millivolts()
This function is just like analog_conversion_result() except the result is returned in millivolts. A return
value of 5000 indicates a voltage 5 V. In most cases, this function is equivalent to
to_millivolts(analog_conversion_result(channel)). However, on the Orangutan SVP, the channels
measured by the auxiliary processor are reported to the AVR in millivolts, so calling
analog_conversion_result_millivolts is more efficient for those channels.
static unsigned int toMillivolts(unsigned int adcResult)
unsigned int to_millivolts(unsigned int adc_result)
Converts the result of an analog-to-digital conversion to millivolts. By default, this assumes an analog
reference voltage of exactly 5000 mV. The analog reference voltage used by this function can be changed
using the set_millivolt_calibration() function.
Example:
OrangutanAnalog::toMillivolts(OrangutanAnalog::read(0));
// e.g. returns 5000 if analog input 0 is at 5 V
to_millivolts(analog_read(0));
// e.g. returns 5000 if analog input 0 is at 5 V
Pololu AVR Library Command Reference © 2001–2015 Pololu Corporation
2. Orangutan Analog-to-Digital Conversion Page 12 of 65