Skip to content

Latest commit

 

History

History
50 lines (45 loc) · 1.25 KB

README.md

File metadata and controls

50 lines (45 loc) · 1.25 KB

logo

smartboard

Integration of Unicorn Smartboard into kcapp

Usage

For detailed information and usage, see the Wiki

Connect

const smartboard = require('./smartboard')();

// Start scanning for the board
smartboard.startScan();
// Register a connect callback, which will be called once board has been found, and connection has been established
smartboard.connect(board-uuid, (peripheral) => {
    // Initialize the board and register callbacks
    smartboard.initialize(peripheral, config.smartboard_button_number,
        (dart) => {
            // Dart throw callback
        },
        () => {
            // Button pressed callback
        }
    );
});

Values

dart object returned contains the following

const dart = {
  score: int ,
  multiplier: int
};

score wil be the value of the field, correctly shifted to account for board rotation mulitplier will be one the following

0 - single (thin)
1 - single (fat)
2 - double
3 - triple

Disconnect

smartboard.disconnect(peripheral, () => {
    // Disconnected
});