Make a directory inside your “tessel-code” folder called “ble”, change directory into that folder, and initialize a tessel project:
mkdir ble; cd ble; t2 init
Plug Tessel into your computer via USB, then plug the BLE module into either of Tessel’s USB ports.
Install noble
by typing npm install noble --force
into the command line (the --force
flag is in case you are on OSX. The library is compatible with Linux (which Tessel uses) but not OSX, so npm blocks downloads to incompatible systems).
Rename “index.js” to “ble.js” and replace the file’s contents with the following:
Save the file.
In your command line, t2 run ble.js
Be sure your BLE peripheral(s) are enabled! You should see Tessel output the address of any nearby BLE peripherals.
Bonus: Make your BLE dongle advertise as a peripheral. Hint: you will need the bleno
library instead of noble
.
To see what else you can do with the BLE dongle, read the noble and bleno documentation.
What else can you do with a BLE module? Get inspired by a community-created project.
What are you making? Share your invention!
If you run into any issues you can check out the ble forums.