This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi there!
Would starting and stopping "Continuous Mode" inside the main loop enable you to average a bunch of samples and then turn "Continuous Mode" back on for reading some other channel?
Here is what I'm trying to do?
#include <Wire.h>
#include <Nanoshield_ADC.h>
Nanoshield_ADC adc;
void setup()
{
Serial.begin(9600);
adc.begin();
adc.setSampleRate(860);
adc.setGain(GAIN_SIXTEEN);
}
void loop()
{
unsigned long sum = 0; // ADC value sum
adc.setContinuous(true);
// Enter continuous mode and start reading channel 2-3 differential(input A2,A3)
adc.readADC_Differential_2_3(); //Does this initiate the continuous mode conversion?
for (int i = 0; i < 860; i++)
{
sum += readNext(); //reading the differential Amps ADC values
}
adc.setContinuous(false); //does this stop continuous conversion?
Serial.print (sum / 860); //Send average value of differential input to Serial Monitor
adc.setContinuous(true);
// Enter continuous mode and start reading channel 0 (input A0)
adc.readADC_SingleEnded(0);
for (int i = 0; i < 860; i++)
{
sum += readNext(); //reading the single ended Volts ADC values
}
adc.setContinuous(false);
Serial.println (sum / 860); //Send average value of single-eded input to Serial Monitor
}