1.1.0 • Published 4 years ago

bluepill-client-library v1.1.0

Weekly downloads
10
License
beerware
Repository
-
Last release
4 years ago

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?)

BluePill.Client.Lib

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.

Install

npm i bluepill-client-library

Import

import { BluePillSocketConnector, BluePillBoard } from 'bluepill-client-library/bin'; // TODO: remove /bin

Usage

const connectionString = 'http://localhost:3000';
const connector = new BluePillSocketConnector(connectionString);
const board = new BLuePillBoard(connector);

board.Input1.OnPress.subscribe(() =>
{
    board.Output1.Toggle();
});

Connectors

Board Connector is a class implementing IBoardConnector interface. This interface contains only two methods: Send and OnUpdate.

Standalone usage

const connector = new BoardSocketConnector('http://localhost:3000');
connector.Set(12, 1234);
connector.OnUpdate = (addr, stateChange) => console.log(addr, stateChange);

Board

IO types and their properties

TypeSettersGettersMethodsEvents
DigitalInputnoneValue, MaxValuenoneOnChange, OnRising, OnFalling, OnPress, OnLongPress
AdcInputnoneValue, MaxValuenoneOnChange, OnRising, OnFalling
DigitalOutputValueValue, MaxValueOn(), Off(), Toggle()OnChange
PwmOutputValueValue, MaxValuenoneOnChange
Clock (RTC)ValueValue, MaxValuenoneOnChange
DisplayValue, DotValue, Dot, MaxValue, MaxDotValuenoneOnValueChange

How to run example?

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.

1.1.0

4 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago