2

I am trying to create c++/c program to AnalogRead using and ADS1115. I have seen that wiringPi has support for ADS1115 but i could not find any sample program to start with. Can anybody link guide me to some sample code to read from an ADS1115.

9
  • Jack, I am a python guy and only know about python programming examples, such as those by AdaFruit: github.com/adafruit/Adafruit_Python_ADS1x15/blob/master/…. AdaFruit uses libraries so it is easy for newbies to start quickly. I usually go to their library's GitHub page and learn how they write the init, setup etc, and DIY my own python programs. I usually think that start prototyping with python, and later "translated" it to C++ is time efficient.
    – tlfong01
    Oct 25, 2019 at 2:45
  • i am trying to benchmark the language first before fully committing since i would need as fast as possible sampling. I know that python is inherently slow compared to C++ thats why im trying to check if by how much.
    – Jack
    Oct 25, 2019 at 3:16
  • I agree with your approach. But I vaguely remember ADS1115 max SPS is less than 1k, so it is for sure the bottle neck, and using C++ won't help.
    – tlfong01
    Oct 25, 2019 at 3:25
  • I might wrongly remember the max sps of ADS1115. Just now I checked another 24 bit ADC ASD1256 and found it is 30kSPS. I also remember that 8/12 bit ADC can do 2k SPS, but not sure.
    – tlfong01
    Oct 25, 2019 at 3:32
  • datasheet say its programmable 8-860 SPS, python produced me only 50 samples in 1 second(by default i did not try to change anything yet) and i need around 300-400. so im seeing what C++ can offer. i would prefer coding it in python too since it makes the other parts of the program easier.
    – Jack
    Oct 25, 2019 at 3:54

1 Answer 1

3

I have found this github that forked the arduino's ads1115 library to be compatible with the raspberry pi.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.