ADS1115 lite library

ahmedfotoh
Posts: 3
Joined: Tue Apr 25, 2023 9:16 am

ADS1115 lite library

Postby ahmedfotoh » 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?

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
}

lbernstone
Posts: 826
Joined: Mon Jul 22, 2019 3:20 pm

Re: ADS1115 lite library

Postby lbernstone » Tue May 14, 2024 5:06 am

Looks like you set the mux for the pin you want to read, trigger the conversion, then get the conversion.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 48 guests