TODO
- all events callbacks should be streams or events emitters/Rx cause now we can attach only one action to each event
- remove RTC?
- remove
/bin
from import (copy bin files level up during publishing?)
It is a client for a BluePill development board
in a form of library.
It is distributed as a node package with TypeScript definition file.
npm i bluepill-client-library
import { BluePillSocketConnector, BluePillBoard } from 'bluepill-client-library/bin';
// TODO: remove /bin
const connectionString = 'http://localhost:3000';
const connector = new BluePillSocketConnector(connectionString);
const board = new BLuePillBoard(connector);
board.Input1.OnPress.subscribe(() =>
{
board.Output1.Toggle();
});
Board Connector is a class implementing IBoardConnector interface. This interface contains only two methods: Send and OnUpdate.
const connector = new BoardSocketConnector('http://localhost:3000');
connector.Set(12, 1234);
connector.OnUpdate = (addr, stateChange) => console.log(addr, stateChange);
Type | Setters | Getters | Methods | Events |
---|---|---|---|---|
DigitalInput | none | Value, MaxValue | none | OnChange, OnRising, OnFalling, OnPress, OnLongPress |
AdcInput | none | Value, MaxValue | none | OnChange, OnRising, OnFalling |
DigitalOutput | Value | Value, MaxValue | On(), Off(), Toggle() | OnChange |
PwmOutput | Value | Value, MaxValue | none | OnChange |
Clock (RTC) | Value | Value, MaxValue | none | OnChange |
Display | Value, Dot | Value, Dot, MaxValue, MaxDotValue | none | OnValueChange |
Connect board to PC with USB or Serial Port. Determine it's port.
Start board's Daemon with appropriate params (host port and usb/serial port).
You are ready now to start board client.
There is few sample apps:
- sample.app.ts
You can start any of them with node bin/SampleApps/sample.app.js
.