2015-12-01 14:57:34 -08:00
|
|
|
/*jslint node:true, vars:true, bitwise:true, unparam:true */
|
|
|
|
/*jshint unused:true */
|
|
|
|
/*
|
|
|
|
* Author: Marc Graham <marc@m2ag.net>
|
|
|
|
* Copyright (c) 2015 Intel Corporation.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
|
|
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
var mraa = require('mraa');
|
|
|
|
var version = mraa.getVersion();
|
|
|
|
|
|
|
|
if (version >= 'v0.6.1') {
|
|
|
|
console.log('mraa version (' + version + ') ok');
|
|
|
|
}
|
|
|
|
else {
|
2015-12-23 17:03:33 -08:00
|
|
|
console.log('mraa version(' + version + ') is old - this code may not work');
|
2015-12-01 14:57:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
var ADS1X15 = require('jsupm_ads1x15');
|
|
|
|
var ads1115 = new ADS1X15.ADS1115(1, 0x49);
|
|
|
|
var ads1015 = new ADS1X15.ADS1015(1, 0x48);
|
|
|
|
|
|
|
|
setInterval(function(){
|
|
|
|
console.log(ads1115.getSample());
|
|
|
|
console.log(ads1015.getSample());
|
|
|
|
console.log("*********************");
|
|
|
|
}, 1000);
|
|
|
|
|
|
|
|
|