Datasheet

For CircuitPython, we've written a get_voltage() helper function to do the math for you. All you have to do is call the
function, provide the pin and print the results.
ENable pin
If you'd like to turn off the 3.3V regulator, you can do that with the EN(able) pin. Simply tie this pin to Ground and it will
disable the 3V regulator. The BAT and USB pins will still be powered
// Arduino Example Code
#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);
import board
import analogio
vbat_voltage = analogio.AnalogIn(board.D9)
def get_voltage(pin):
return (pin.value * 3.3) / 65536 * 2
battery_voltage = get_voltage(vbat_voltage)
print("VBat voltage: {:.2f}".format(battery_voltage))
© Adafruit Industries
https://learn.adafruit.com/adafruit-feather-m0-express-designed-for-circuit-python-
circuitpython
Page 28 of 199