CircuitPython nRF52840 help - Battery Monitor

I’ve been looking at examples for using the built in battery monitor on the SEED Xiao nRF52840
I was guided to the pin out (thanks for that) and I tried using the pins called for in the spreadsheet, but none of them work. My code just spits out
AttributeError: ‘module’ object has no attribute ‘x’

This is my code I am starting with. I have tried using D14, READ_BAT and even AC9 for x. None seem to work.

read_bat_out = digitalio.DigitalInOut(board.x)#P0.14
read_bat_out.direction = digitalio.Direction.OUTPUT
read_bat_out.value = True #OFF

Do I have an import problem? Or perhaps what I am doing just doesn’t work?

My goal is periodically take a reading of the battery voltage using P0.14 and P0.31.

What also kind of concerns me is the spreadsheet has no pin definition for P0.31 in the SEEED studio columns. So I am not sure this is doable.

One other thing I was hoping to achieve, assuming I am able to figure out how to read the above, is to put the SEEED module to sleep. I have found an example in the wiki, here


But it’s in C. Does anyone know the Python equivalent?

OK I was able to figure out the deep sleep function.

I also finally was informed of and able to find some examples on how to get the pin out in the console.
After learning about the dir(board) command, I used the example shown on this page to print it to Putty.

And, for anyone else, the pin definitions for nRF5820 are:
board.A0 board.D0 (P0_02)
board.A1 board.D1 (P0_03)
board.A2 board.D2 (P0_28)
board.A3 board.D3 (P0_29)
board.A4 board.D4 board.SDA (P0_04)
board.A5 board.D5 board.SCL (P0_05)
board.CHARGE_RATE (P0_13)
board.CHARGE_STATUS (P0_17)
board.D10 board.MOSI (P1_15)
board.D6 board.TX (P1_11)
board.D7 board.RX (P1_12)
board.D8 board.SCK (P1_13)
board.D9 board.MISO (P1_14)
board.IMU_INT1 (P0_11)
board.IMU_PWR (P1_08)
board.IMU_SCL (P0_27)
board.IMU_SDA (P0_07)
board.LED board.LED_RED (P0_26)
board.LED_BLUE (P0_06)
board.LED_GREEN (P0_30)
board.MIC_PWR (P1_10)
board.NFC1 (P0_09)
board.NFC2 (P0_10)
board.PDM_CLK (P1_00)
board.PDM_DATA (P0_16)
board.READ_BATT_ENABLE (P0_14)
board.VBATT (P0_31)

This conflicts with the getting started spreadsheet. But it finally works with my code.