issues with formatting a string using sprintf()


I've got and LCD working and i want to write a temperature to the screen, but nicely formatted.

Everything works except they only formatting function I found:

printf(char,"Temperature is: %4.1f,tempF);

Prints: Temperature is: ?

See my code snipped, anyone know how to do this?

I sure miss VB...

double v;
char buf [30];

void setup() {
  // put your setup code here, to run once:

void loop() {
  // put your main code here, to run repeatedly:

v = 987/8;

//i want to print a nice formated string like
// The value is: 123.4

sprintf(buf, "The value is: %4.1f", v);

// but the output is
// The value is:    ?


Get rid of the sprintf() call and use:

dtostrf(v, 7, 3, buf);

instead. The floating point formatting in sprintf() is not available.

As to VB, once you get used to C, you'll throw rocks at VB.

AVR has support disabled for printF. Break it up into separate calls to print/println, do as econjack mentioned, or you can try modify the code. Here is an example someone has recently written: