Hi,
I've been trying to get my head around various different formating options for sprintf_P. The following code....
const prog_char TEST_03[] PROGMEM = "char<%c>,integer<%d>,integer<%d>,unsigned integer<%u>,unsigned integer<%u>, byte<%d>,byte<%d>,long<%ld>,long<%ld>,unsigned long<%lu>,unsigned long<%lu>.";
char testChar='a';
int testIntMin = -32768;
int testIntMax = 32767;
unsigned int testUnIntMin = 0;
unsigned int testUnIntMax = 65535;
byte testByteMin = 0;
byte testByteMax = 255;
long testLongMin = -2147483648L ;
long testLongMax = 2147483647L;
unsigned long testUnLongMin = 0UL;
unsigned long testUnLongMax = 4294967295UL;
char info[300];
sprintf_P(info,TEST_03,testChar,testIntMin,testIntMax,testUnIntMin,testUnIntMax,testByteMin,testByteMax,testLongMin,testLongMax,testUnLongMin,testUnLongMax);
Serial.println(info);
Produces what appears to be the correct result...
char<a>,integer<-32768>,integer<32767>,unsigned integer<0>,unsigned integer<65535>, byte<0>,byte<255>,long<-2147483648>,long<2147483647>,unsigned long<0>,unsigned long<4294967295>.
However, having fiddled with this for ages, it's apparent that there can be big difference between getting it to work with a particular value, and getting it to work with all values.
Can someone please confirm that that the formatting options I've used should work with all possible values of the variables I'm using?
Cheers