I'm guessing I'm going to feel like an idiot when I find out the answer to this but here goes...
I was writing a large program and am fairly familiar with both C++ & Arduino but one piece didn't want to work. I finally narrowed it down to a char compare line. As it made no sense to me that it wasn't working I created a simple program (see the code below) to try and see if it was something else in the large program causing the problem. However, the problem occurs even in the stripped down version. If I run it as is then the output is [BA][CA] repeated over and over which shouldn't be since status is not A so the "if" should not be true so the output s/b [BA] repeated over and over. If I change the 'A' to 'X' it still gives the same output which in that case it should.
Please help this one to understand the error of his ways. Thanks!
char status ;
void setup()
{
Serial.begin(115200) ;
Serial.println("Processing...") ;
}
void loop()
{
status='A';
Serial.print('{');
Serial.print('B');
Serial.print(status);
Serial.print('}');
if(status == 'X') ;
{
Serial.print('{');
Serial.print('C');
Serial.print(status);
Serial.print('}');
}
delay(3000) ;
}