I am having some issues with the ADS1115, every time I try to use the readADC_SingleEnded(uint8_t channel) or any other function the only thing that I can get is -1.
Here is the code:
Code: Select all
#include<Wire.h>
//Ads
#include <Adafruit_ADS1015.h>
Adafruit_ADS1115 ads1115(0x49);
void setup()
{
pinMode(9, OUTPUT); // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
digitalWrite(9, HIGH);
Serial.begin(9600);
ads1115.begin();
}
void loop(){
int adc0, adc1, adc2, adc3;
adc0 = ads1115.readADC_SingleEnded(0);//Wire.read();//ads1115.readADC_Differential_0_1();//ads1115.readADC_SingleEnded(0);
adc1 = ads1115.readADC_SingleEnded(1);
adc2 = ads1115.readADC_SingleEnded(2);
adc3 = ads1115.readADC_SingleEnded(3);
Serial.print("AIN0: "); Serial.println(adc0);
Serial.print("AIN1: "); Serial.println(adc1);
Serial.print("AIN2: "); Serial.println(adc2);
Serial.print("AIN3: "); Serial.println(adc3);
delay(1000);
}
Solution:
There were a couple of problems:
1. The wires where in the right place but they were not doing contact with ADS.
2. I was still getting weird results after fixing the contacts,and it was because the ground was at 3500...