Hi All,
My code now compiles without error. I upload the software to my Uno with breadboard and the loop runs fine but the output is always zero. (Code is below).
Is there any way to trouble shoot the program or chip? Vdd=5v. A0=0.2v, A1=A2+a3=0v, ADR=GND,ALRT=open.
------example output---------
Waiting...
A0: -1
A1: -1
A2: -1
A3: -1
Waiting...
A0: -1
A1: -1
A2: -1
A3: -1
----- end -----------
---- code ------------
#include <Wire.h>
#include <Adafruit_ADS1015.h>
Adafruit_ADS1115 ads; // construct an ads1115 at address 0x48
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
int nchars=0;
// the setup routine runs once when you press reset:
void setup() {
Serial.begin(9600);
pinMode(led, OUTPUT);
Serial.println("Getting single-ended readings from AIN0..3");
Serial.println("ADC Range: +/- 6.144V (1 bit = .15mV)");
ads.begin();
ads.setGain(GAIN_ONE); // 1x gain +/- 4.096V
}
// the loop routine runs over and over again forever:
void loop() {
int16_t adc0, adc1, adc2, adc3;
adc0 = ads.readADC_SingleEnded(0);
adc1 = ads.readADC_SingleEnded(1);
adc2 = ads.readADC_SingleEnded(2);
adc3 = ads.readADC_SingleEnded(3);
Serial.print("A0: "); Serial.println(adc0);
Serial.print("A1: "); Serial.println(adc1);
Serial.print("A2: "); Serial.println(adc2);
Serial.print("A3: "); Serial.println(adc3);
Serial.println(" ");
digitalWrite(led, HIGH);
delay(500);
digitalWrite(led, LOW);
delay(5000);
// Serial in/out
if ( (nchars = Serial.available()) > 0) {
Serial.print("blink, nchars = ");
Serial.println(nchars);
Serial.flush();
}
else {
Serial.println("Waiting...");
}
}
--------- end -----------------