Home › Forums › Mayfly Data Logger › Looking for a bare-bones 16 bit 0-5V dc data logger sketch to build off of › Reply To: Looking for a bare-bones 16 bit 0-5V dc data logger sketch to build off of
2017-01-23 at 1:24 PM
#1937
How are you trying to talk to the analog pins? To get the 16 bit ADD conversion you must use the auxiliary ADD converter/library for the Ti ADS 1115. Here’s a bit of code that may help you along. (Please note that this code is completely the work of Shannon Hicks!)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#include <Adafruit_ADS1015.h> /* The library for the auxiliary ADD */ Adafruit_ADS1115 ads; /* Use this for the 16-bit version */ int16_t adc0, adc1; // adc2, adc3; /* Tells which channels are to be read */ // Read Channels adc0 = ads.readADC_SingleEnded(0); adc1 = ads.readADC_SingleEnded(1); // now convert bits into millivolts float lowvoltage = (adc0 * 3.3) / 17585.0; float highvoltage = (adc1 * 3.3) / 17585.0; |