UNPKG

di-sensors

Version:

Drivers and examples for using DI_Sensors in Node.js

50 lines (40 loc) 2.09 kB
'use strict'; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // https://www.dexterindustries.com/GoPiGo/ // https://github.com/DexterInd/DI_Sensors // // Copyright (c) 2017 Dexter Industries // Released under the MIT license (http://choosealicense.com/licenses/mit/). // For more information see https://github.com/DexterInd/GoPiGo3/blob/master/LICENSE.md var BME280 = require('./BME280'); var TempHumPress = function () { function TempHumPress() { var bus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'RPI_1'; _classCallCheck(this, TempHumPress); this.sensor = new BME280(bus, BME280.OSAMPLE_2, BME280.OSAMPLE_4, BME280.OSAMPLE_4, BME280.STANDBY_10, BME280.FILTER_8); } _createClass(TempHumPress, [{ key: 'getTemperatureCelsius', value: function getTemperatureCelsius() { return this.sensor.readTemperature(); } }, { key: 'getTemperatureFahrenheit', value: function getTemperatureFahrenheit() { return this.sensor.readTemperatureF(); } }, { key: 'getPressure', value: function getPressure() { return this.sensor.readPressure(); } }, { key: 'getHumidity', value: function getHumidity() { return this.sensor.readHumidity(); } }]); return TempHumPress; }(); module.exports = TempHumPress;