aarg:
Or you can use the streaming library
or a little template...
template<class T> inline Print &operator << (Print &obj, T arg)
{
obj.print(arg);
return obj;
}
void setup()
{
Serial.begin(9600);
int i = 3;
Serial << F("I have ") << i << F(" banana") << (i == 1? F("\n") : F("s\n"));
// char phrase[20];
// sprintf(phrase, "I have %d banana%s", i, (i == 1? "\n" : "s\n"));
// Serial.print(phrase);
}
void loop() {
}
check it out with floats and compare its memory usage to sprintf....