I am programming an Arduino to control a LED Strip using the Fast_SPI.lib (Although this problem has nothing to do with the Fast_SPI.lib I guess)
Right now I am controlling a strip with 32 LEDs, I get an input in my Arduino of 96 decimal values (R,G,B for each LED) coming from my Terminal software (HTerm on Win 7). I store the values each in an unsigned char Array, one after the other.
I kind of created my own protocol standard, which means, that the input has to start with 1 then 3 and then followed by the actual input. The end of the communication is indicated by the value 251. So in the following you see the relevant part of my code:
int a=0, b=0;
Serial.println("begin"); //just for debug reasons
if(Header==Serial.read() && Header==Serial.read()) //Header contains 1, Header  contains 3
Serial.println("ok"); //just for debug reasons
Endstr=1; //set to 1 to continue with the next loop
else Serial.println("not"); //just for debug reasons
/*I am referring to the following two Serial.println functions
Supposed, I have a correct input (beginning with 1 3) I have following strange problem:
If I use either one of the two centered serial.println functions (doesn"t matter which one), the check whether the input begins with 1 3 will succeed.
If I don't use any of the two print functions, the check will fail.
The strange thing now, as you may already have realized, is that the Serial.print function is in the while loop, after the check. So actually any code written in this while loop should not affect the check, especially as the succeeded check will grant the while loop to begin.
So, hopefully someone of you has an idea where the problem is, or maybe it is even a bug of the arduino platform??
Thanks in advance for your help!