Prints 2 lines every 3 seconds instead of one !
It seems that the sprintf function istelf prints on the serial monitor.
This only happens when Serial.print is used (0 lines if not)
In your first instance, "str"points to a single byte which is a string terminator, which doesn't leave much (aka any) room to write anything.
Your second example has room for 19 characters plus terminator.
Ask yourself this: what is the size of str in your code? (Hint: All pointers in an Arduino IDE use 2 bytes of memory). Now, how much memory does it take to store the string "Hello\n"? (Hint: More than 2 bytes.)
econjack:
Ask yourself this: what is the size of str in your code? (Hint: All pointers in an Arduino IDE use 2 bytes of memory). Now, how much memory does it take to store the string "Hello\n"? (Hint: More than 2 bytes.)
Thanks a lot. You're both right. Changing :
char strCode[12]="";
//to :
char strCode[12];
Fixed the case
And by the way the linker does not complain anymore with the Error 5 when I remove declaration of an unused variable (I kept to avoid the error).