Hey this is odd. I'm using a different program now, before I was using a C program I found on github. This node program is some code I threw together from some examples. At first I get 0v on channel 0, the one connected to ground! That is the correct value. But then it switches to 8191. Odd huh?
When I ran the program again, it starts outputting 8191 right away. But occasionally I'll get a 0.
Here is the code.
When I ran the program again, it starts outputting 8191 right away. But occasionally I'll get a 0.
Here is the code.
Code:
const ADS1115 = require('ads1115')
const i2c = require('i2c-bus')
i2c.openPromisified(1).then(async (bus) => {
const ads1115 = await ADS1115(bus)
ads1115.gain = 1
var coef = .125
for (let i = 0; i < 1000; i++) {
var value = await ads1115.measure('0+GND')
value = value * coef
console.log('0: '+ value)
var value = await ads1115.measure('1+GND')
value = value * coef
console.log('1: '+ value)
var value = await ads1115.measure('2+GND')
value = value * coef
console.log('2: '+ value)
var value = await ads1115.measure('3+GND')
value = value * coef
console.log('3: '+ value)
}
})