Skip to content
This repository was archived by the owner on Dec 20, 2019. It is now read-only.

Commit d3d71bd

Browse files
hgwoodHugo Wood
authored andcommitted
Add instructions for Windows with WinUSB and Windows with Node.js Chakra
1 parent 75ccac9 commit d3d71bd

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ env:
33

44
rules:
55
camelcase: [2, {properties: "always"}]
6-
comma-dangle: "always-multiline"
6+
comma-dangle: 0
77
comma-spacing: [2, {before: false, after: true}]
88
comma-style: [2, "last"]
99
handle-callback-err: [2, "^.*(e|E)rr" ]

README.markdown

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,20 @@ peripheral discovered (f3f26d557108 with address <f3:f2:6d:55:71:08, random>, co
146146

147147
In the above output, the device address is `f3f26d557108` (or alternately `f3:f2:6d:55:71:08`). Use this value to connect to your BB-8 or Ollie.
148148

149-
### Windows
149+
### Windows 8.1+ with WinUSB
150+
151+
To connect to your BB-8 or Ollie, you will need to be running Windows 8.1+. Follow [these instructions](https://github.com/sandeepmistry/noble#windows). Note that only [4 Blueooth adapters](https://github.com/sandeepmistry/node-bluetooth-hci-socket#compatible-bluetooth-40-usb-adapters) are compatible and that you will not be able to use your adapter through Windows and through Node.js at the same time.
152+
153+
### Windows 10 with Node.js Chakra
154+
155+
If you are running Windows 10 with the November 2015 update, you may install a version of Node.js which executes on top of the Microsoft Chakra JS engine, and has access to the Windows native Bluetooth stack.
150156

151-
To connect to your BB-8 or Ollie, you will need to be running Windows 8.1+. Instructions coming soon...
157+
- Follow the instructions [here](https://github.com/hgwood/winble#install-all-the-things) to install Node.js Chakra, along with [winble](https://github.com/hgwood/winble), a Windows plugin for noble, and noble itself. Noble 1.4 or newer is required.
158+
- Pair your device with Windows as normal (Start Menu > Settings > Devices > Bluetooth) (this might be already done)
159+
- Hit Windows+X, select Device Manager > Bluetooth > double-click on your device name > Details > select "Bluetooth device address" and copy the address
160+
- Use the code snippet from the Usage section with the address
161+
- Add a second parameter to the `sphero` function like so: `sphero('<address>', {nobleBindings: require('winble')})`
162+
- Run the code using the Node.js Chakra command prompt
152163

153164
## Connecting to Sphero/SPRK
154165

lib/adaptors/ble.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,22 @@ var util = require("util"),
55

66
var ble;
77

8-
function initBLE() {
8+
function initBLE(options) {
99
var isChrome = typeof chrome !== "undefined";
1010

1111
// thanks to https://github.com/jgautier/firmata/blob/master/lib/firmata.js
1212
try {
1313
if (isChrome) {
1414
// browser BLE interface here...
1515
console.error("Browser-based BLE interface is not yet supported.");
16+
} else if (options.nobleBindings) {
17+
ble = require("noble/with-bindings")(options.nobleBindings);
1618
} else {
1719
ble = require("noble");
1820
}
1921
} catch (error) {
2022
ble = null;
23+
console.error(error);
2124
}
2225

2326
if (ble == null) {
@@ -49,7 +52,7 @@ var Adaptor = module.exports = function Adaptor(peripheralId, options) {
4952
if (this.noblePeripheral) {
5053
ble = this.noblePeripheral._noble;
5154
} else {
52-
initBLE();
55+
initBLE(opts);
5356
}
5457
this.peripheral = null;
5558
this.connectedPeripherals = {};

0 commit comments

Comments
 (0)