Hi There
I am currently using the Arduino UNO to read three ADC channels.
I am making use of the Arduino IDE but not the analogRead() function.
The code works well, but my problem is, the order in which the data is being printed to the serial monitor differs from the order of the code, e.g. instead of displaying 0-1-2 it displays 2-0-1. The last value is always being printed first, irrespective of the order
Any advice please.
Francois
void loop() {
ADMUX = 0b11100000; // select channel 0
delay(10); //delay 1 second
ADCSRA |= (1 << ADSC); //start single conversion
analogData = ADCH; //store data in analogData variable
float volt = (analogData/255.0)*1.1;
Serial.print(volt);
Serial.print(" ");
ADMUX = 0b11100001; // select channel 1
delay(10); //delay 1 second
ADCSRA |= (1 << ADSC); //start single conversion
analogData = ADCH; //store data in analogData variable
float volt1 = (analogData/255.0)*1.1;
Serial.print(volt1);
Serial.print(" ");
ADMUX = 0b11100010; //select channel 2
delay(10); //delay 1 second
ADCSRA |= (1 << ADSC); //start single conversion
analogData = ADCH; //store data in analogData variable
float volt2 = (analogData/255.0)*1.1;
Serial.println(volt2);
delay(1000); //delay 1 second
}