npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ble-serialport

v0.1.8

Published

Virtual serial device over BLE

Downloads

748

Readme

BleSerialPort

A virtual node-serialport implementation that uses BLE as the transport.

Prerequisites

First you need git and node.js to clone this repo and install dependencies:

git clone https://github.com/elin-moco/ble-serialport
cd ble-serialport
npm install

Secondly, you'll need an Arduino board with BleShield added on top of it, put an LED on pin 7, connect Arduino to you computer, and upload this BleFirmataSketch firmware to it.

To use BLE to send/receive data to the device with firmata or Johnny Five, run below gulp tasks to browserify them like:

gulp build

You'll find the browserified scripts in build folder

Use with Johnny Five

Include Johnny Five bundle script in your html file:

  <script type="text/javascript" src="j5-bundle.js"></script>

To use with node.js, you'll need these two require statements:

var BleSerialPort = require('ble-serialport').SerialPort;
var five = require('johnny-five');

Then use it directly in your script:

var bsp = new BleSerialPort({address: 'd0:6a:cf:58:ee:bd'}); //put your device name or address here
bsp.connect().then(function() {
  var board = new five.Board({port: bsp, repl: false});
  board.on('ready', function() {
    var led = new five.Led(7);
    led.blink();
  });
});

And you should see the LED blinks once you have the webapp(page) opened.

Use with Firmata

Include the firmata bundle script in your html file:

  <script type="text/javascript" src="firmata-bundle.js"></script>

To use with node.js, you'll need these two require statements:

var BleSerialPort = require('ble-serialport').SerialPort;
var firmata = require('firmata');

Then use it directly in your script:

var bsp = new BleSerialPort({address: 'd0:6a:cf:58:ee:bd'}); //put your device name or address here
bsp.connect().then(function() {
  var board = new firmata.Board(sp);
  board.on('ready', function() {
    board.digitalWrite(7, board.HIGH);
  });
});

And you should see the LED on once you have the webapp(page) opened.

Runing Examples

For the fxos-j5 and cordova-j5 example, run following commands to copy bundle script to example/fxos-j5 directory:

gulp dist

For the fxos-j5 example, modify example/fxos-j5/fxos-j5.js for your device address.
Then install app via WebIDE.

For the node-j5 and node-firmata examples, just update the address and run with:

node node-firmata.js

or

node node-j.js

For the cordova-j5 example, See cordova-j5 readme file for instructions for initialization and deployment.

Support

Currently this implementation uses WebBluetooth V2 API on FxOS, which is still experimental and requires certified permissions for now.

For the hardware part, now only tested with Arduino+BleShield, might need some tweaks for different BLE modules.

See blue-yeast if you are interested in enabling this for other platforms.