Skip to main content

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:

ClassDescription
BoardManages the connection to an Arduino board.
ComponentBaseAbstract base class all hardware components extend. Provides the value getter and event emitter API.
DigitalActorBase class for digital output components (on/off control).
AnalogSensorBase class for analog input components reading 0–1023 values.
AnalogActorBase class for PWM output components (0–255 range).
ButtonBase class for digital input with software debouncing.

#Component Classes

#Input Components

ClassComponent(s)Description
AccelerometerAccelerometerAccelerometer component for reading pitch and roll from LIS3DH sensor
BarometerBarometerBarometer component for reading pressure and temperature from BMP280 sensor
CO2SensorCO2 SensorCO2 Sensor component for reading CO2 concentration from Grove MH-Z16 sensor
ColorSensorColor SensorColorSensor component for reading RGB color values from TCS34725/TCS3472 sensor
EncoderEncoderRotary encoder component
JoystickJoystickJoystick component for reading X/Y position and button state
PotentiometerPotentiometer, Slide PotentiometerBase class for analog input components that read continuous values (e.g
SunlightSensorSunlight SensorSunlightSensor component for reading UV index, infrared, and visible light from SI1145 sensor

#Output Components

ClassComponent(s)Description
BuzzerBuzzerBuzzer / Piezo component for driving a passive piezo buzzer via the serial protocol.
HapticlabsHapticlabsHapticlabs dual-channel haptic feedback controller
LCDLCDLCD component for controlling a 16x2 I2C character display with RGB backlight (Grove LCD RGB Backlight)
LedLEDLED component for digital output (on/off only)
LedDimmableLED (Dimmable)Dimmable LED component for PWM output (0-255)
LEDMatrixLED MatrixLEDMatrix component for controlling Grove RGB LED Matrix w/Driver (8x8 RGB matrix)
LEDStripLED StripLEDStrip component for controlling addressable LED strips (NeoPixel/WS2812)
MotorDriverMotor DriverGrove I2C Motor Driver component
OLEDOLEDOLED display component for drawing text and monochrome graphics on a 128×64 pixel screen.
ServoMotorServo MotorServoMotor component for controlling servo motors
StepperMotorStepper MotorStepperMotor component for controlling stepper motors via AccelStepper (STEP/DIR driver)

#Control Components

ClassComponent(s)Description
CounterCounterCounter that tracks an integer value, incremented or decremented by triggers.
MetronomeMetronomeMetronome that emits a tick event at a configurable frequency (in milliseconds).
SignalTowerClassSignal Tower
TimerTimerTimer that counts elapsed time in seconds and emits tick events at a 50 ms resolution.

#Integrations

ClassComponent(s)Description
FigmaIntegrationFigmaIntegration that sends commands to Figma prototypes and receives interaction events from them.
SocketIOIntegrationProtoPie Player, Socket.IOIntegration that sends and receives messages over a Socket.IO connection, enabling communication with external apps and services.