Uno R3
arduino IDE 1.0.5-R2
example tutorial this is all based on:
I'll start off by saying I've got no formal training in programming, I'm completely self taught via the internet, and I still don't know much at all.
I have the ADS1115 breakout board and the tutorial provided favors the ADS1015 so I have a few questions. I am using the ADS1115 to read a pressure transducer that has mV output(0-5 psi=0-25mV @5V excitation). I have the Vs pin connected to the arduino 5V, I have the gnd pin connected to arduino ground, the V+ pin is connected to A0, and the V- pin is connected to A1. I have a syringe and some tube I'm using to put pressure on the transducer. Running the sample code, I can see the values shift as I apply pressure.
If I run the example code from the tutorial with everything as ADS1015 it works, but if I edit the code to ADS1115, it does not.
This works:
#include <Wire.h>
#include <Adafruit_ADS1015.h>
Adafruit_ADS1015 ads1015;
void setup(void)
{
Serial.begin(9600);
Serial.println("Hello!");
Serial.println("Getting differential reading from AIN0 (P) and AIN1 (N)");
Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV)");
ads1015.begin();
}
void loop(void)
{
int16_t results;
results = ads1015.readADC_Differential_0_1();
Serial.print("Differential: "); Serial.print(results); Serial.print("("); Serial.print(results * 3); Serial.println("mV)");
delay(1000);
}
This is from the serial monitor:
Hello!
Getting differential reading from AIN0 (P) and AIN1 (N)
ADC Range: +/- 6.144V (1 bit = 3mV)
Differential: 0(0mV)
Differential: 0(0mV)
Differential: -9(-27mV)
Differential: 5(15mV)
Differential: 0(0mV)
Differential: 0(0mV)
Differential: 0(0mV)
Differential: 0(0mV)
Differential: 0(0mV)
Differential: 0(0mV)
Differential: 5(15mV)
Differential: 15(45mV)
Differential: 15(45mV)
Differential: 15(45mV)
Differential: 11(33mV)
Differential: 0(0mV)
Differential: 0(0mV)
Differential: 0(0mV)
Differential: 0(0mV)
If I edit it to this it does not work:
#include <Wire.h>
#include <Adafruit_ADS1115.h>
Adafruit_ADS1115 ads1115;
void setup(void)
{
Serial.begin(9600);
Serial.println("Hello!");
Serial.println("Getting differential reading from AIN0 (P) and AIN1 (N)");
Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV)");
ads1115.begin();
}
void loop(void)
{
int16_t results;
results = ads1115.readADC_Differential_0_1();
Serial.print("Differential: "); Serial.print(results); Serial.print("("); Serial.print(results * 3); Serial.println("mV)");
delay(1000);
}
I get the error
'AdafruitADS1115' does not name a type
So am I still getting the full 16 bit resolution when I use the code with ADS1015 written everywhere? I assume this is an error internal to the library?
The next question is regarding the getGain command. How do I implement it to check the gain level on the ADC?
Thanks in advance,
Robert