Learn how companies like Phone2Action are using npm in their front-end developmentJoin the conversation »

@abandonware/bmp085-sensor

0.0.6-1 • Public • Published

BMP085.js

Access a BMP085 temperature & barometric pressure sensor from your Raspberry Pi using Node.js.

NPM

Install

$ npm install bmp085-sensor

Usage

With no units specified, returns inHg and degree F.

var bmp085 = require('bmp085-sensor');
 
var sensor = bmp085({address: 0x77,
                     mode: 3});
 
sensor.calibrate(function (err, data) {                                                                                                                                                                                                                                        
  if(err || !data) {                                                                                                                                                                                                                                                           
     throw err;                                                                                                                                                                                                                                                                
  }                                                                                                                                                                                                                                                                            
  console.log(data);                                                                                                                                                                                                                                                           
  sensor.read(function (err, data) {                                                                                                                                                                                                                                           
    if(err || !data) {                                                                                                                                                                                                                                                         
      throw err;                                                                                                                                                                                                                                                               
    }                                                                                                                                                                                                                                                                          
    // data is { pressure: 29.957463223223005, temp: 68.9 }
  });                                                                                                                                                                                                                                                                          
});
 

You can also specify metric units, returning Pa and degree C:

var bmp085 = require('bmp085-sensor');
 
var sensor = bmp085({address: 0x77,
                     mode: 3,
                     units: 'metric'});
 
sensor.calibrate(function (err, data) {                                                                                                                                                                                                                                        
  if(err || !data) {                                                                                                                                                                                                                                                           
     throw err;                                                                                                                                                                                                                                                                
  }                                                                                                                                                                                                                                                                            
  console.log(data);                                                                                                                                                                                                                                                           
  sensor.read(function (err, data) {                                                                                                                                                                                                                                           
    if(err || !data) {                                                                                                                                                                                                                                                         
      throw err;                                                                                                                                                                                                                                                               
    }                                                                                                                                                                                                                                                                          
    // data is { pressure: 101435.97, temp: 20.5 }
  });                                                                                                                                                                                                                                                                          
});

Using alt runtime IoT.js

make runtime=iotjs
# iotjs test.js  
# ... 
#   "temperature": 32.3 
#   "pressure": 100855.38749926083, 
# ... 

Resources

Install

npm i @abandonware/bmp085-sensor

DownloadsWeekly Downloads

2

Version

0.0.6-1

License

MIT

Unpacked Size

13.7 kB

Total Files

6

Last publish

Collaborators

  • avatar
  • avatar