JavaScript / Node.js API
The @blokdots/components package provides Node.js classes for communicating with Arduino boards via the blokdots serial protocol.
#Installation
Shell
npm install @blokdots/components#Base Classes
Foundation classes with their own full API reference:
| Class | Description |
|---|---|
| Board | Manages the connection to an Arduino board. |
| ComponentBase | Abstract base class all hardware components extend. Provides the value getter and event emitter API. |
| DigitalActor | Base class for digital output components (on/off control). |
| AnalogSensor | Base class for analog input components reading 0–1023 values. |
| AnalogActor | Base class for PWM output components (0–255 range). |
| Button | Base class for digital input with software debouncing. |
#Component Classes
#Input Components
| Class | Component(s) | Description |
|---|---|---|
Accelerometer | Accelerometer | Accelerometer component for reading pitch and roll from LIS3DH sensor |
Barometer | Barometer | Barometer component for reading pressure and temperature from BMP280 sensor |
CO2Sensor | CO2 Sensor | CO2 Sensor component for reading CO2 concentration from Grove MH-Z16 sensor |
ColorSensor | Color Sensor | ColorSensor component for reading RGB color values from TCS34725/TCS3472 sensor |
Encoder | Encoder | Rotary encoder component |
Joystick | Joystick | Joystick component for reading X/Y position and button state |
Potentiometer | Potentiometer, Slide Potentiometer | Base class for analog input components that read continuous values (e.g |
SunlightSensor | Sunlight Sensor | SunlightSensor component for reading UV index, infrared, and visible light from SI1145 sensor |
#Output Components
| Class | Component(s) | Description |
|---|---|---|
Buzzer | Buzzer | Buzzer / Piezo component for driving a passive piezo buzzer via the serial protocol. |
Hapticlabs | Hapticlabs | Hapticlabs dual-channel haptic feedback controller |
LCD | LCD | LCD component for controlling a 16x2 I2C character display with RGB backlight (Grove LCD RGB Backlight) |
Led | LED | LED component for digital output (on/off only) |
LedDimmable | LED (Dimmable) | Dimmable LED component for PWM output (0-255) |
LEDMatrix | LED Matrix | LEDMatrix component for controlling Grove RGB LED Matrix w/Driver (8x8 RGB matrix) |
LEDStrip | LED Strip | LEDStrip component for controlling addressable LED strips (NeoPixel/WS2812) |
MotorDriver | Motor Driver | Grove I2C Motor Driver component |
OLED | OLED | OLED display component for drawing text and monochrome graphics on a 128×64 pixel screen. |
ServoMotor | Servo Motor | ServoMotor component for controlling servo motors |
StepperMotor | Stepper Motor | StepperMotor component for controlling stepper motors via AccelStepper (STEP/DIR driver) |
#Control Components
| Class | Component(s) | Description |
|---|---|---|
Counter | Counter | Counter that tracks an integer value, incremented or decremented by triggers. |
Metronome | Metronome | Metronome that emits a tick event at a configurable frequency (in milliseconds). |
SignalTowerClass | Signal Tower | |
Timer | Timer | Timer that counts elapsed time in seconds and emits tick events at a 50 ms resolution. |
#Integrations
| Class | Component(s) | Description |
|---|---|---|
FigmaIntegration | Figma | Integration that sends commands to Figma prototypes and receives interaction events from them. |
SocketIOIntegration | ProtoPie Player, Socket.IO | Integration that sends and receives messages over a Socket.IO connection, enabling communication with external apps and services. |