2017-03-08 23:28:45 -08:00
|
|
|
/*
|
|
|
|
* Author: Abhishek Malik <abhishek.malik@intel.com>
|
|
|
|
* Copyright (c) 2017 Intel Corporation.
|
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* This program and the accompanying materials are made available under the
|
|
|
|
* terms of the The MIT License which is available at
|
|
|
|
* https://opensource.org/licenses/MIT.
|
2017-03-08 23:28:45 -08:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-03-08 23:28:45 -08:00
|
|
|
*/
|
|
|
|
|
2017-04-04 13:38:28 -07:00
|
|
|
var abp = require("jsupm_abp");
|
2017-03-08 23:28:45 -08:00
|
|
|
|
|
|
|
// Instantiate a Honeywell ABP Pressure Sensor at bus 0
|
2017-04-04 13:38:28 -07:00
|
|
|
var abp_sensor = new abp.ABP(0, 0x28);
|
2017-03-08 23:28:45 -08:00
|
|
|
|
|
|
|
var myInterval = setInterval(function()
|
|
|
|
{
|
2017-04-04 13:38:28 -07:00
|
|
|
abp_sensor.update();
|
|
|
|
console.log("Pressure: " + abp_sensor.getPressure());
|
|
|
|
console.log("Temperature: " + abp_sensor.getTemperature());
|
2017-03-08 23:28:45 -08:00
|
|
|
}, 100);
|
|
|
|
|
|
|
|
// When exiting: clear interval and print message
|
|
|
|
process.on('SIGINT', function()
|
|
|
|
{
|
|
|
|
clearInterval(myInterval);
|
|
|
|
console.log("Exiting...");
|
|
|
|
process.exit(0);
|
2017-04-04 13:38:28 -07:00
|
|
|
});
|