Integration of Unicorn Smartboard into kcapp
For detailed information and usage, see the Wiki
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
}
);
});
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
smartboard.disconnect(peripheral, () => {
// Disconnected
});