ADS1xxx-Series-ADC-Libraries / ADS1255-ADS1256

Arduino Library for Texas Instrument ADS1256 Very Low Noise, 24-Bit Analog-to-Digital Converter
MIT License
24 stars 11 forks source link

Function adc.begin(drate, gain, bufferenable) works, while adc.begin() doesn't #7

Open jurc192 opened 2 years ago

jurc192 commented 2 years ago

When using adc.begin() without any parameters I only get "inf" outputs from the sensor (sensor clipped, not reacting to changes in light, always infinite). If I use begin function with specified drate, gain and bufferenable everything works okay. Any idea what might be broken?

Code I use:

#include <ADS1256.h>
#include <SPI.h>

float clockMHZ = 8.0;
float vRef = 2.5;

ADS1256 adc(clockMHZ,vRef,false);
float sensor1;

void setup()
{
  Serial.begin(9600);
//   adc.begin(ADS1256_DRATE_30000SPS, ADS1256_GAIN_1, false);   // this works ok
  adc.begin();    // this doesn't work, always infinite
  adc.setChannel(0,1);
}

void loop()
{ 
  adc.waitDRDY();
  sensor1 = adc.readCurrentChannel();
  Serial.println(sensor1, 10);
}