SDK docs menu

Guides

Parts

Every part on the board is available by its schematic reference designator. This is how you tell identical parts apart, such as two temperature sensors on the same bus.

By reference designator

board.U3.do("set-ambient-temperature", 30)
board.do("U3.set-ambient-temperature", 30)    # the same
assert not board.U3.read("alert-pin")
print(board.U5.readings())

board.U3 is Board.part("U3"), in any case. A reference designator the board doesn't have raises an error that lists the ones it has.

List the parts

for part in board.parts():
    print(part)
# U3 MCP9808 — Temperature sensor, i2c0 0x18, simulated
#   do   U3.set-ambient-temperature <value -20..100 °C>
#   do   U3.room-25-c
#   do   U3.warm-55-c
#   do   U3.overheat-75-c
#   read U3.alert-pin
# U9 BME280 — Environment sensor, i2c0 0x76, not simulated
#   (nothing to do or read on this part)

Passives are left out. Parts the simulation doesn't model are still listed, so the list shows what isn't simulated.

Find parts by where they sit

board.parts(bus="i2c0")                       # every part on a bus
board.find(bus="i2c0", address=0x6B)          # exactly one part, or LookupError
board.parts(connected_to="U1", status="not_simulated")

for part in board.mcu.connected():            # every part the processor reaches
    print(part.ref, part.bus, part.address, part.mcu_pins)

board.U43.behind                              # "U42": the I2C switch it sits behind

Wiring comes from the board's netlist. A board without one knows only the bus and address its parts list gives each part. See Part for every field, and your board's parts for how the CLI and website show them.