0

ADS1115 Library problem
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ADS1115 Library problem

by proaudio on Thu Sep 10, 2015 3:59 am

Hello, I just bought an ADS1115 board and I try to run with an Arduino, but I have compilation problems... I need some help. Thank you very much.

Code:
Code: Select all | TOGGLE FULL SIZE
#include <Wire.h>

#include <Adafruit_ADS1015.h>


Adafruit_ADS1015 ads1015;
 
void setup(void)
{
  Serial.begin(9600);
  Serial.println("Hello!");
 
  Serial.println("Getting single-ended readings from AIN0..3");
  Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV)");
  ads1015.begin();
}
 
void loop(void)
{
  int16_t adc0, adc1, adc2, adc3;
 
  adc0 = ads1015.readADC_SingleEnded(0);
  adc1 = ads1015.readADC_SingleEnded(1);
  adc2 = ads1015.readADC_SingleEnded(2);
  adc3 = ads1015.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);
  Serial.println(" ");
 
  delay(1000);
}


Error:

singleended.cpp.o: In function `setup':
C:\Program Files (x86)\Arduino/singleended.ino:15: undefined reference to `Adafruit_ADS1015::begin()'
singleended.cpp.o: In function `loop':
C:\Program Files (x86)\Arduino/singleended.ino:22: undefined reference to `Adafruit_ADS1015::readADC_SingleEnded(unsigned char)'
C:\Program Files (x86)\Arduino/singleended.ino:23: undefined reference to `Adafruit_ADS1015::readADC_SingleEnded(unsigned char)'
C:\Program Files (x86)\Arduino/singleended.ino:24: undefined reference to `Adafruit_ADS1015::readADC_SingleEnded(unsigned char)'
C:\Program Files (x86)\Arduino/singleended.ino:25: undefined reference to `Adafruit_ADS1015::readADC_SingleEnded(unsigned char)'
singleended.cpp.o: In function `__static_initialization_and_destruction_0':
C:\Program Files (x86)\Arduino/singleended.ino:6: undefined reference to `Adafruit_ADS1015::Adafruit_ADS1015(unsigned char)'
collect2.exe: error: ld returned 1 exit status
Multiple libraries were found for "Wire.h"
Used: C:\Users\G\Documents\Arduino\libraries\Wire
Not used: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire
Compilation Error

proaudio
 
Posts: 1
Joined: Thu Sep 10, 2015 3:53 am

Re: ADS1115 Library problem

by adafruit_support_rick on Thu Sep 10, 2015 12:39 pm

You have not correctly installed the Adafruit_ADS1015.h library.
https://github.com/adafruit/Adafruit_ADS1X15

Please refer to this tutorial on installing Arduino libraries:
https://learn.adafruit.com/adafruit-all ... nstall-use

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: ADS1115 Library problem

by Apiniti on Sun Jan 15, 2017 1:38 pm

I am having the same problem. Error message keeps coming up. I think I installed the library correctly. Please help.

Arduino: 1.8.0 (Windows 8.1), Board: "Arduino/Genuino Uno"

avr-g++: error: C:\Users\lenovo pc\Documents\Arduino\libraries\Adafruit_ADS1X15-master\Adafruit_ADS1015.cpp: No such file or directory

avr-g++: warning: '-x c++' after last input file has no effect

avr-g++: fatal error: no input files

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Apiniti
 
Posts: 2
Joined: Sun Jan 15, 2017 1:35 pm

Re: ADS1115 Library problem

by Apiniti on Sun Jan 15, 2017 1:53 pm

Now I realised that the compiling problem only happened with Arduino IDE 1.8.0. No problem with the classic IDE 1.0.6.

Apiniti
 
Posts: 2
Joined: Sun Jan 15, 2017 1:35 pm

Re: ADS1115 Library problem

by adafruit_support_rick on Sun Jan 15, 2017 2:58 pm

That's unexpected. Try installing the library again.

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Please be positive and constructive with your questions and comments.