Feather M0 - Lipo Voltage reading - Bug in tutorial ?
Posted: Fri Apr 29, 2016 8:56 am
Hi,
In the M0 tutorial... https://learn.adafruit.com/adafruit-fea ... ng-battery
you are reading the Lipo Voltage and convert the reading to voltage with the following code.
However, the M0 ADC have a resolution of 12 bits so the value should go from 0 to 4095 when reading the voltage.
So the line
should become for the feather M0.
Am'I right?
In the M0 tutorial... https://learn.adafruit.com/adafruit-fea ... ng-battery
you are reading the Lipo Voltage and convert the reading to voltage with the following code.
Code: Select all
#define VBATPIN A7
float measuredvbat = analogRead(VBATPIN);
measuredvbat *= 2; // we divided by 2, so multiply back
measuredvbat *= 3.3; // Multiply by 3.3V, our reference voltage
measuredvbat /= 1024; // convert to voltage
Serial.print("VBat: " ); Serial.println(measuredvbat);
So the line
Code: Select all
measuredvbat /= 1024; // convert to voltage
Code: Select all
measuredvbat /= 4096; // convert to voltage