upm/examples/javascript/ads1x15.js
Mihai Tudor Panu 89d5de43e0 license: update to SPDX style license text throughout
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2020-03-05 15:13:36 -08:00

32 lines
821 B
JavaScript

/*
* Author: Marc Graham <marc@m2ag.net>
* Copyright (c) 2015 Intel Corporation.
*
* 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.
*
* SPDX-License-Identifier: MIT
*/
var mraa = require('mraa');
var version = mraa.getVersion();
if (version >= 'v0.6.1') {
console.log('mraa version (' + version + ') ok');
}
else {
console.log('mraa version(' + version + ') is old - this code may not work');
}
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);