This is just a quick question to anyone here that has set up their ADC with their arduino (Mega 2560 or UNO).
There's a line of code that's commonly used .... this one here...
ADMUX = bit (REFS0) | (adcPin & 0x07); // AVcc
where, 'adcPin' is often the A0 analog input pin on the arduino, generally defined by:
const byte adcPin = 0; // A0
Just going to ask somebody here .... is the "& 0x07" part of the code necessary?
Would the following line of code be ok to use too?
ADMUX = bit (REFS0) | (adcPin); // AVcc
I'm thinking that the 0x07 part could be to just ensure that bit positions b3, b4, b5, b6, b7 remain all '0' regardless of value is assigned to adcPin, right? Thanks for your help in advance!