AnalogIn functionality mismatch

The documentation for AnalogIn implies more functionality than what is in the .h file from the online compiler. What am I missing.

Documentations here: Mbed OS Reference | AnalogIn Class Reference

AnalogIn.h has:
AnalogIn

Hello,

please be so kind and ignore the “documentation” from the online compiler, it is obsolete. Correct documentation (for MbedOS 6.10) is from link what you posted above.

BR, Jan

but the functionality from the link does not work

The link works perfectly for me? Why do you say it doesn’t? What do you see ?

Sorry - bad wording - the link implies a method set_reference_voltage exists, but it is not in the AnalogIn.h file and the compiler throws an error (no such method) when I try to use it. I don’t know what is causing the discrepancy between the documentation and the implementation.

Are you sure you have latest version of MbedOS in your project when you use latest documentation?

BR, Jan

Using the online compiler - I assumed it was the latest version. I don’t see ver # listed anywhere.

See
Just click on mbed-os library and the press Revision button or right click on mbed-os library and also chose Revisions...

Mine looks exactly like yours - could you check the AnalogIn.h file and see if it matches the documentation?

Look, the AnalogIn.h is not visible in the Online Compiler only on the github and the documentation on the webside.

I tried compile the code below and it is ok.

#include "mbed.h"

int main(){
    printf("Mbed OS version %d.%d.%d\n\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
    AnalogIn ain(A0);
    ain.set_reference_voltage(3.1);
    while(true) {
        thread_sleep_for(2000);
    }
}

BR, Jan

I really appreciate the help - I ran Johnny K’s code and it fails due to no such function. I commented out the function and got: Mbed OS version 5.14.2 I am running the online compiler. Why isn’t it defaulting to the latest revision? How do I fix this? My revision check was identical to his from the previous post.

The selected revision in the list must be in bold.

Just open revisions and choose version of the MbedOS what you want and right click on it. Then chose like on the picture.

Also you can right click on the mbed-os library in your project and chose Update.

It depends on from where you downloaded it or how you started your project.

BR, Jan