After changing my code not to use the String class anymore but use char arrays, i ran into another problem
void loop()
{
char tx[100];
long TestA = 1;
word TestB = 1;
sprintf (tx, "%d %d %d %d", TestA, 2, 3, 4);
Serial.println(tx);
sprintf (tx, "%d %d %d %d", TestB, 2, 3, 4);
Serial.println(tx);
}
I would have expected the to outputs to be the same, but they are not.
It outputs the following two lines:
1 0 2 3
1 2 3 4
Can anybody explain this to me?
Isn't it possible to use a long or unsigned long with sprintf?
regards
Mirko