-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/kcapp/smartboard
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}); | ||
``` | ||
|