Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/kcapp/smartboard
Browse files Browse the repository at this point in the history
  • Loading branch information
thordy committed Sep 22, 2019
2 parents a2e39f0 + 7f19c1f commit 8ff60da
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,51 @@
![logo](https://raw.githubusercontent.com/wiki/kcapp/smartboard/images/logo.png)
# smartboard
Integration of [Unicorn Smartboard](https://www.unicornsmartboard.com/smartboard.html) into kcapp


## Usage
For detailed information and usage, see the [Wiki](https://github.com/kcapp/smartboard/wiki)

### Connect
```javascript
var smartboard = require('./smartboard')("<smartboard uuid>", <button number>);

// 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((peripheral) => {
smartboard.initialize(peripheral,
(dart) => {
// Dart throw callback
},
() => {
// Button pressed callback
}
);
});
```

#### Values
`dart` object returned contains the following
```javascript
var 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
```javascript
smartboard.disconnect(peripheral, () => {
// Disconnected
});
```

0 comments on commit 8ff60da

Please sign in to comment.