Guides
Controls and readings
A board's controls are its inputs: a bench supply, a sensor's value, a button, a cable plugged in. Its readings are the values its panels show. Both use the same names as the website, the CLI and scenario files.
Names
Names have the form <panel>.<control>, such as bench-supply.volts. The part after the dot is enough when only one panel has it. A part's controls and readings also answer to its reference designator, such as U3.set-ambient-temperature (see Parts).
List a board's controls:
for c in board.controls():
print(c.usage)
# bench-supply.volts <value 0..24 V>
# usb.plugged-in on|off
# reset.pressFrom a terminal, npx hardlabs run --list -s company_name/board_name prints the same list.
Change an input
board.do("reset.press") # a button
board.do("usb.plugged-in", True) # a toggle
board.do("bench-supply.volts", 11.5) # a number
board.do("bench-supply.set", volts=5.0) # a form with named valuesWhat Board.do takes depends on the control's kind; see Control.
Read a value
assert board.read("power-monitor.bus-current") < 0.2
r = board.reading("power-monitor.bus-current")
print(r.value, r.unit, r.text) # the value, its unit, and how the panel shows it
print(board.readings()) # every reading, by nameBoard.read returns the value alone: a number, True/False, a name, or None when the board doesn't report it. Board.reading returns a Reading with its unit and label.