I'm just wondering why this test code doesn't work...
int id1=0;
boolean test1=false;
void setup()
{
Serial.begin(9600);
}
void loop()
{
if (Serial.available()>0)
{
id1=Serial.read();
test1=(id1=='A');
if (id1==true)
{
Serial.println(test1);
}
}
}
If I enter 'A' in the serial monitor I get no response. If I comment out the if() statement like so:
//if (id1==true)
//{
Serial.println(test1);
}//
}
}
I get a '1' when I enter an 'A' and a '0' when I enter any other character. What's going on??
Thanks!!