frankzappa
Well-known member
Hello!
I'm trying to do calculations while waiting for conversions to finish.
Is it guaranteed that ADC0 will read sensor A0 and sensor A2? And
ADC1 will always read A1 and A3 in this code? If not, is there a way
I can change the code to do that?
I'm trying to do calculations while waiting for conversions to finish.
Is it guaranteed that ADC0 will read sensor A0 and sensor A2? And
ADC1 will always read A1 and A3 in this code? If not, is there a way
I can change the code to do that?
Code:
void loop()
{
adc->startSynchronizedSingleRead(A0, A1);
//Calculations on previous sensor pair
from second time through the loop (A2, A3);
while (adc->adc0->isConverting() || adc->adc1->isConverting());
g_sensorValue[0] = 1023 - (adc->adc0->readSingle());
g_sensorValue[1] = 1023 - (adc->adc1->readSingle());
adc->startSynchronizedSingleRead(A2, A3);
//Calculations on previous sensor pair (A0, A1);
while (adc->adc0->isConverting() || adc->adc1->isConverting());
g_sensorValue[2] = 1023 - (adc->adc0->readSingle());
g_sensorValue[3] = 1023 - (adc->adc1->readSingle());
}