Comparing version 1.0.3 to 2.0.0
{ | ||
"name": "nodeimu", | ||
"version": "1.0.3", | ||
"version": "2.0.0", | ||
"description": "Native addon for accessing IMU/pressure/humidity/temperature sensors using RTIMULib2", | ||
@@ -5,0 +5,0 @@ "license": "BSD-2-Clause-FreeBSD", |
31
test.js
var util = require('util') | ||
var nodeimu = require('./index.js'); | ||
var IMU = new nodeimu.IMU(); | ||
function dispAccel() { | ||
var data = IMU.getValue(); | ||
var sx = data.accelx >= 0 ? ' ' : ''; | ||
var sy = data.accely >= 0 ? ' ' : ''; | ||
var sz = data.accelz >= 0 ? ' ' : ''; | ||
var str = util.format('ax:%s%s ay:%s%s az:%s%s', sx, data.accelx.toFixed(4), sy, data.accely.toFixed(4), sz, data.accelz.toFixed(4)); | ||
var str2 = util.format(' t:%s p:%s h:%s', data.temperature.toFixed(4), data.pressure.toFixed(4), data.humidity.toFixed(4)); | ||
var num = 0; | ||
console.time("async"); | ||
var callb = function (e, data) { | ||
if (e) { | ||
console.log(e); | ||
return; | ||
} | ||
var sx = data.accel.x >= 0 ? ' ' : ''; | ||
var sy = data.accel.y >= 0 ? ' ' : ''; | ||
var sz = data.accel.z >= 0 ? ' ' : ''; | ||
var str = util.format('%s%s %s%s %s%s', sx, data.accel.x.toFixed(4), sy, data.accel.y.toFixed(4), sz, data.accel.z.toFixed(4)); | ||
var str2 = util.format(' %s %s %s', data.temperature.toFixed(4), data.pressure.toFixed(4), data.humidity.toFixed(4)); | ||
console.log(str + str2); | ||
num++; | ||
if (num == 100) { | ||
console.timeEnd("async"); | ||
} else { | ||
setTimeout(function() { IMU.getValue(callb); } , 50); | ||
} | ||
} | ||
setInterval(dispAccel, 50); | ||
IMU.getValue(callb); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
2438759
315
58