I can't find any documentation for the options for analogReference()
.
By default the reference voltage seems to be Vcc, but there's an AREF pin, so I assume it must be possible to select that instead.
I can't find any documentation for the options for analogReference()
.
By default the reference voltage seems to be Vcc, but there's an AREF pin, so I assume it must be possible to select that instead.
Yes you optionally use your own reference.
analogReference() command.
So the options are DEFAULT, INTERNAL, and EXTERNAL?
When I try analogReference(EXTERNAL)
I get:
exit status 1
'EXTERNAL' was not declared in this scope
I've confirmed that the options DEFAULT
, INTERNAL
, and EXTERNAL
are not recognised by the compiler, so how does choose to use the external analogue reference on the AREF pin?
Or is it pulled to Vcc, so if you leave it unconnected you get AREF = Vcc?
I got the same issue. Have you been able to find a solution? Thanks
No, sorry, I haven't.
Hi all. I'm not knowledgeable on this subject, but I saw this comment from someone who is:
https://github.com/arduino/ArduinoCore-mbed/issues/161#issuecomment-1106208028
To set the analog reference in STM32H7 boards there's no need to call any function, just connect the external reference to AREF pin and it will be used. I'm going to add an empty function with a warning at compile time to make the linker happy.
Here is the implementation of the "empty function" mentioned above:
And another here:
https://github.com/arduino/ArduinoCore-mbed/issues/161#issuecomment-1143495047
As far as I know, an external voltage reference is required for stable readings. When not connecting it, it automatically uses the internal voltage reference via weak pull-ups.
So you have the options of a rough internal ~3.3 V reference or you can connect an external reference. Either way, it is all done electrically with no need for any modifications to the code. There isn't the programmable reference selection capability like we have in the AVR boards so analogReference
is irrelevant for these boards.