I am doing a little project by using serial com.
I got this part of code written to print strings (source:Arduino Playground - Printf)
#include <stdarg.h>
void p(char *fmt, ... ){
char tmp[128]; // resulting string limited to 128 chars
va_list args;
va_start (args, fmt );
vsnprintf(tmp, 128, fmt, args);
va_end (args);
Serial.print(tmp);
}
loop(){
unsigned long a=0xFFFFFFFF;
p("Decimal a: %l\nDecimal unsigned a: %lu\n", a, a);
p("Hex a: %x\n", a);}
but when I updated it to UNO, it always returned,
Decimal a:?
Hex a:?
what's wrong? Thanks!