a me non piace com'è impostato ma, seguendo il tuo ragionamento, quello che dovresti fare è:
char virgola = ',';
int elemento = 0;
char Letto[3];
boolean ok = false;
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0)
{
char c = Serial.read();
if (ok == true) {
Letto[elemento] = c;
elemento++;
}
if (c == virgola) {
ok = true;
}
if (elemento == 2) {
Serial.println(Letto);
ok = false;
elemento = 0;
}
}
}
l'ordine con cui si verificano ed eseguono le azioni è importante....
ATTENZIONE: il mio baudrate è 9600...