volatile bool adc_coversion_done = false;
void ARDUINO_ISR_ATTR adcComplete(void) {
adc_coversion_done = true;
}
void setup() {
uint8_t adc_pins[] = { 1, 2, 3, 4 };
analogContinuous(adc_pins, 4, 5, 1000, &adcComplete);
analogContinuousStart();
Serial.begin(9600);
}
void loop() {
adc_continuous_data_t *result = NULL;
if (adc_coversion_done == true) {
adc_coversion_done = false;
if (analogContinuousRead(&result, 0)) {
for (int i = 0; i < 4; i++) {
Serial.printf("\nADC PIN %d data:",
result[i].pin);
Serial.printf("\n Avg raw value = %d",
result[i].avg_read_raw);
Serial.printf("\n Avg millivolts value = %d",
result[i].avg_read_mvolts);
}
delay(1000);
}
}
}