Step 1

Make a directory inside your "tessel-code" folder: enter mkdir ble into your command line, then change directory into that folder: cd ble

Step 2

Plug the BLE module into Tessel port A with the hexagon/icon side down and the electrical components on the top, then plug Tessel into your computer via USB.

Step 3

Install by typing npm install ble-ble113a into the command line.

Step 4

Save this code in a text file called ble.js:

// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/

/*********************************************
This Bluetooth Low Energy module demo scans
for nearby BLE peripherals. Much more fun if
you have some BLE peripherals around.
*********************************************/

var tessel = require('tessel');
var blelib = require('ble-ble113a');

var ble = blelib.use(tessel.port['A']);

ble.on('ready', function(err) {
  console.log('Scanning...');
  ble.startScanning();
});

ble.on('discover', function(peripheral) {
  console.log("Discovered peripheral!", peripheral.toString());
});

Step 5

In your command line, tessel run ble.js
Set a Bluetooth Low Energy device to advertising and see if Tessel can find it!

Bonus: Change the code to print out only the address of discovered peripherals.

To see what else you can do with the BLE module, see the module docs here.

Step 6

What else can you do with a BLE module? Try a community-created project.


What are you making? Share your invention!

If you run into any issues you can check out the BLE forums.

Choose another module

Or if you're all set, move on to Wifi.

Fork on Github