I’m currently using something like:
uint32_t XTalkCompensationRateMegaCps;
// A function writes a uint32_t value to this pointer
// Later I try to print it
char str[20];
snprintf(str, sizeof(str), "%ld", XTalkCompensationRateMegaCps);
Log.info(str);
Is this correct?
@nrobinson2000, since you are specifying an unsigned long, you would use %lu
instead of %ld
1 Like
Ok thanks. Trying that now.
1 Like
BTW, if this is just for logging and str
isn’t used otherwise, this would work too
Log.info("%lu", XTalkCompensationRateMegaCps);
2 Likes
And what if I wanted to particle.publish it?
@nrobinson2000, then keep the snprintf() and str
so you can publish it.
2 Likes