Hi,
I am trying to use the ads1115 adc to collect data from three inputs. I am using the ads1x15 library for Arduino. Using the example code, I get ~38 SPS. How do I increase the sampling rate?
thanks,
Moderators: adafruit_support_bill, adafruit
#define ADS1115_RATE_8 0x00
#define ADS1115_RATE_16 0x01
#define ADS1115_RATE_32 0x02
#define ADS1115_RATE_64 0x03
#define ADS1115_RATE_128 0x04 // default
#define ADS1115_RATE_250 0x05
#define ADS1115_RATE_475 0x06
#define ADS1115_RATE_860 0x07
#include <Wire.h>
#include <Adafruit_ADS1015.h>
Adafruit_ADS1115 ads1115;
void setup(void)
{
Serial.begin(115200);
Serial.println("Hello!");
Serial.println("Getting single-ended readings from AIN0..3");
Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV)");
ads1115.begin();
}
void loop(void)
{
int16_t adc0, adc1, adc2, adc3;
adc0 = ads1115.readADC_SingleEnded(0);
adc1 = ads1115.readADC_SingleEnded(1);
adc2 = ads1115.readADC_SingleEnded(2);
Serial.print(millis());
Serial.print(",");
Serial.print(adc0);
Serial.print(",");
Serial.print(adc1);
Serial.print(",");
Serial.print(adc2);
Serial.println(",");
}
adafruit_support wrote:You have about 18mS worth of serial printing in your loop. That will slow things down a bit.
Return to Other Arduino products from Adafruit
Users browsing this forum: No registered users and 2 guests