Skip to content

🔌 Bluetooth Transport Plugin for webduino-js

License

Notifications You must be signed in to change notification settings

webduinoio/webduino-bluetooth-transport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webduino-bluetooth-transport

Bluetooth Transport Plugin for webduino-js

Prerequisite

When running in browser, you must have the following installed:

  1. API Proxy for Google Chromeâ„¢ (launch before opening your application)
  2. API Proxy Agent for Google Chromeâ„¢

to interface with Webduino/Arduino via Bluetooth.

Installation

Browser

See also: webduino-js

The webduino-base.js or webduino-all.js has bundled serial and bluetooth transports by default. If you have successfully built it or use the CDN version, you are ready to go.

Cordova

Using bower:

$ bower install webduinoio/webduino-bluetooth-transport

In project directory:

$ cordova plugin add cordova-plugin-bluetooth-serial

Insert script after webduino-base.js (or webduino-all.js):

<script src="bower_components/webduino-js/dist/webduino-base.js"></script>
<script src="bower_components/webduino-bluetooth-transport/src/CordovaBluetoothTransport.js"></script>
<script src="bower_components/webduino-js/src/module/Led.js"></script>
... (modules used)

Node.js

$ npm install webduino-bluetooth-transport

Usage

webduino-js provides isomorphic APIs:

// need to acquire 'webduino' in Node.js:
// var webduino = require('webduino-js');

var board, led;

board = new webduino.Arduino({
  transport: 'bluetooth',
  address: 'xx:xx:xx:xx:xx:xx'
});

// Or:
// board = new webduino.Arduino({
//   transport: require('webduino-bluetooth-transport'),
//   address: 'xx:xx:xx:xx:xx:xx'
// });

board.on('ready', function() {
  led = new webduino.module.Led(board, board.getDigitalPin(10));
  led.on();
});

About

🔌 Bluetooth Transport Plugin for webduino-js

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published