Node.js module for BlendMicro and BLENano with BLE.
Node.js <---(BLE)---> BlendMicro/BLENano
- using noble npm as BLE wrapper
- serialport npm like API
sites
% npm i blendmicro
% npm i blendmicro coffee-script -g
% blendmicro -help
% blendmicro -list
% blendmicro -term [DEVICE_NAME]
see samples directory.
blendmicro side
#include <SPI.h>
#include <boards.h>
#include <RBL_nRF8001.h>
void setup(){
ble_set_name("BlendMicro");
ble_begin();
}
if you are using BLE Nano, see samples/
directory.
node.js side
var BlendMicro = require('blendmicro');
// search device with BLE peripheral name
var bm = new BlendMicro("BlendMicro");
// search with deefault name "BlendMicro"
var bm = new BlendMicro();
bm.on('open', function(){
console.log("open!!");
});
bm.on("data", function(data){
console.log(data.toString());
});
bm.write("hello");
bm.write( new Buffer([1,2,3]) );
bm.close(function(){
console.log("closed");
});
bm.reconnect = false // default is "true" (enabled)
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request