Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ble-bean

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ble-bean - npm Package Compare versions

Comparing version 0.7.0 to 0.7.1

2

package.json
{
"name": "ble-bean",
"version": "0.7.0",
"version": "0.7.1",
"description": "Lightblue Bean BLE Services",

@@ -5,0 +5,0 @@ "main": "lib/bean.js",

@@ -0,1 +1,62 @@

##BLE-Bean
Non Official api for the LightBlue Bean http://punchthrough.com/bean/
ble-bean is set up a litte differently than other libraries. I'm playing with exposing services and characteristics, rather than the device. You need to use noble to search for services, and create an instance of Bean or Scratch. See the example.
###INSTALL
```
npm install ble-bean
```
####Bean:
You can wite data which can be read on arduino with Serial.read - in this instance 91,00,00 is firmata for all pins on port 0 low
```
connectedBean.write(new Buffer([0x91,0x00,0x00]),callback(error));
```
You can read the raw data from the device with:
```
connectedBean.on("read", callback(data, valid, seq, size));
```
Or theres a job specific emitters to do parsing for you, like accelerometer:
```
connectedBean.on("accell", callback(x, y, z, valid, seq));
```
To read the accelerometer though, you need to ask it to take a reading with:
```
connectedBean.requestAccell(callback(error));
```
You can set the led color (in this case to a random color) with:
```
connectedBean.setColor(new Buffer([getRandomInt(0,64),getRandomInt(0,255),getRandomInt(0,255)]), callback(error));
```
If theres something I haven implemented you can create it yourself with the send command. See commands.js for commandBuffers to use:
```
connectedBean.send(commandBuffer, dataBuffer, callback(error));
```
####Scratch:
Scratch characteristics are 5 other characterists you can send and receive data on from the Arduino. See the reference page for more info: http://punchthrough.com/bean/arduino-reference/
You can write to the first scratch like:
```
connectedScratch.write1("scratch1", new Buffer([]), callback(error));
```
And you could listen for data on it like:
```
connectedScratch.on("scratch1", callback(data));
```
###CHANGELOG
0.1.0

@@ -19,2 +80,8 @@ first

refactor for cleaner code
add write scratch characteristics
add write scratch characteristics
0.7.0
add write serial data to bean characteristic
0.7.1
Better readme, no code changes.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc