I am attempting to implement an analog input port to read the battery voltage. My design requires that I set the reference voltage (to something other than Vdd).
The code to do this should look like
#include "mbed.h"
AnalogIn VCC_monitor(GPIO0); // input to read VCC state via a resistor divider network
int main () {
VCC_monitor.set_reference_voltage(3.1); // set the reference here (but this function is not in the library) // <-- this line will not compile
// do something to read the voltage etc. e.g.
float volts = VCC_monitor.read(); // a line like this works ok
}
I am using the mbed online compiler, I believe I am running mbed o/s 6.2.0 (target is a Multitech xdot)
It does not compile because set_voltage_reference does not exist.
When I look at analogIn.h I can see that AnalogIn::set_reference_voltage() does not exist in the library.
When I look at 5.x versions of mbed o/s it looks like the class in those versions did not have set_voltage_reference(). So how was the reference voltage set previously?
Please advise any suggestions as to how to locate the required function. I have been through the reference documentation and searched to no avail.