Switch to the Arduino's Internal Reference

I’m new to XOD but am loving it so far. I have one question at the moment, how do I switch the Arduino to use the Internal ADC Reference. I’m using an Arduino Nano so the MCU is the 328p and the command is "analogReference(INTERNAL).

Would I need to build a node or use the developer tools to add this line to a sketch.

Thanks for your help.

Anyone, I would really appreciate any help. Especially if I’m missing something really simple.

Thanks again

I have no idea what that is supposed to do, but worst-case, you can create a node and use not-implemented-in-xod with the following code:

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    ::analogReference(INTERNAL)
}

Presumably this only needs to execute once during startup to apply some global setting in Arudino, so it just needs to exist in your patch and probably doesn’t need any pins.

1 Like

This sets the reference volatage for the ADC’s to the internal Band Gap Refernce that’s built in to the MCU. There is very little voltage drift on this so my readings will be much more accurate. In the case of the 328p the Vref is 1.1V.