Use the correct size for i and it will work as expected.
sprintf(tstr, "k[%ld] = %lu\n", i, k[i]);
Easy to catch if you had activated warnings:
Somewhere\strangefor\strangefor.ino:17:43: warning: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t {aka long unsigned int}' [-Wformat=]
sprintf(tstr, "k[%d] = %lu\n", i, k[i]);
Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Thanks.. Tom..
Sorry. Will not happen again. I duplicate code, because econjack can't see it in original post, maybe some browser incompatibility.
Whandall:
Use the correct size for i and it will work as expected.
sprintf(tstr, "k[%ld] = %lu\n", i, k[i]);
Easy to catch if you had activated warnings:
Somewhere\strangefor\strangefor.ino:17:43: warning: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t {aka long unsigned int}' [-Wformat=]
sprintf(tstr, "k[%d] = %lu\n", i, k[i]);
Many thanks! It's my coding error. It's a shame.
I tried to simplify my program to show error. Now I think it is bad idea. The real error was hiding behind the wrong debugging output.