0
I am monitoring more than one analog input of one Arduous at all times, that is, at all times I am sending data via serial to other software. What would be the best way to send this data so that I can recognize in other software what analog input of the Arduous each data received belongs to?
int CANAL1, CANAL2, CANAL3;
void setup() {
Serial.begin(115200);
pinMode(A0, INPUT); // configura como entrada
digitalWrite(A0, LOW);
pinMode(A1, INPUT); // configura como entrada
digitalWrite(A1, LOW);
pinMode(A2, INPUT); // configura como entrada
digitalWrite(A2, LOW);
analogReference(DEFAULT);
}
void loop() {
CANAL1 = analogRead(A0);
Serial.print(CANAL1,DEC);
Serial.print(" ");
delay(5);
CANAL2 = analogRead(A1);
Serial.print(CANAL2,DEC);
Serial.print(" ");
delay(5);
CANAL3 = analogRead(A2);
Serial.print(CANAL3,DEC);
Serial.print(" ");
delay(5);
}
Doing so the data arrives in the serial in sequence. Example:
0 1023 500 1023 400 500 300 200
So if I lose a data, either one, I already totally lose the orientation of which input corresponds to each value.