Board constants

hub.board (hub._board_module) exposes board- specific pin numbers and configuration. Values are set by the C firmware from Board.h at compile time.

SD card

Attribute

Meaning

SD_MODE

0 = SPI, 1 = SDMMC

SD_SLOT

SDMMC slot number

SD_CS

Chip-select (SPI mode)

SD_SCK

Clock (SPI mode)

SD_MOSI

MOSI (SPI mode)

SD_MISO

MISO (SPI mode)

SD_WIDTH

SDMMC bus width, 1 or 4

SD_CLK

SDMMC clock pin

SD_CMD

SDMMC command pin

SD_D0..``SD_D3``

SDMMC data lines

Mounting an SD card (SPI):

import machine, os, hub
b = hub.board
sd = machine.SDCard(slot=b.SD_SLOT, cs=machine.Pin(b.SD_CS),
                    sck=machine.Pin(b.SD_SCK),
                    mosi=machine.Pin(b.SD_MOSI),
                    miso=machine.Pin(b.SD_MISO))
os.mount(sd, "/sd")

Port pins

Each external port has two ID pins (analog-ID / LPF2 identification) and two H-bridge PWM channels:

Attribute

Meaning

PORT_x_ID_1 / PORT_x_ID_2

Port x identification lines

PORT_x_PWM_1 / PORT_x_PWM_2

Port x H-bridge PWM channels

Where x is A, B, C, D. These are exposed for low-level board bring-up — for normal use, drive motors via the port’s LPF2 API (Motors).