Skip to main content

Board

#Extends

  • EventEmitter

#Constructors

#Constructor

TypeScript
new Board(portPath?, options?): Board;

Create a Board instance.

#Parameters

ParameterTypeDescription
portPath?string | nullSerial port path (e.g. "/dev/tty.usbserial-XXXX" or "COM3"). Pass null or omit to auto-detect the connected blokdots board. Example: "/dev/tty.usbserial-XXXX" on Mac, "COM3" on Windows.
options?BoardOptionsOptional configuration (expectedHash, autoDetectTimeoutMs).

#Returns

Board

#Overrides

TypeScript
EventEmitter.constructor

#Methods

#close()

TypeScript
close(callback?): void;

#Parameters

ParameterType
callback?() => void

#Returns

void


#isConnected()

TypeScript
isConnected(): boolean;

#Returns

boolean


#queryConfigHash()

TypeScript
queryConfigHash(): void;

Query the board's config hash. The board will respond with a 'hash' event containing the hash string.

#Returns

void


#registerComponent()

TypeScript
registerComponent(id, component): void;

Register a component with the board. Accepts Pin (number for digital, string for analog), I2CPinID, or any string identifier. Converts to string internally for Map storage.

#Parameters

ParameterType
idstring | number
componentComponentBase

#Returns

void


#sendCommand()

TypeScript
sendCommand(command): void;

#Parameters

ParameterType
commandstring

#Returns

void