Hi,
Experimenting with ser comm I found yet another interesting issue I can't explain. Please look at this code:
char a;
char m[10];
int i = 0;
void setup()
{
Serial.begin(9600);
Serial.flush();
}
void loop()
{
while(Serial.available()>0 && a != '@')
{
a = Serial.read();
m[i++] = a;
if(i>=10 || a=='@')
{
i = 0;
Serial.println(m);
}
}
}
This fairly simple code has a bug I can't figure out: when I run it, and say I enter kkk@ it prints it as expected. After this it stops working and if I enter, say, ttt@ it does nothing! Any other attempt to make it println something fails!
Do you see the problem there please?