ADS1115 lite library
Posted: Mon May 13, 2024 9:01 am
Hi everyone ,
I use ads1115 module lite library by [terryjmyers]
(terryjmyers (Terry J Myers) · GitHub 1)/**ADS1115-Lite**library to measure voltage.I get the one channel voltage reading.
How to read 4 channels of ADS1115 module?
I use ads1115 module lite library by [terryjmyers]
(terryjmyers (Terry J Myers) · GitHub 1)/**ADS1115-Lite**library to measure voltage.I get the one channel voltage reading.
How to read 4 channels of ADS1115 module?
Code: Select all
#include <Wire.h>
#include<ADS1115_lite.h>
ADS1115_lite ads(ADS1115_DEFAULT_ADDRESS); // 0x48 addr pin connected to GND
float raw = 0;
float resolution=0;
void setup() {
Serial.begin(115200);
ads_config();
}
void loop() {
raw=ads_read();
resolution=6144.0/32752.0;
float result=(raw*resolution)/1000.0;
Serial.print("volt = ");
Serial.println(result);
delay(200);
}
void ads_config(){
ads.setGain(ADS1115_REG_CONFIG_PGA_6_144V); // GAIN_ONE and resolution to ± 4.096V
ads.setSampleRate(ADS1115_REG_CONFIG_DR_128SPS); // Set to the fastest MODE 860Samples per sec
}
int16_t ads_read(){
ads.setMux(ADS1115_REG_CONFIG_MUX_SINGLE_0);
ads.triggerConversion(); // Triggered mannually
return ads.getConversion(); // returns int16_t value
}