LCD to print floats?

Recently I got an LCD shield and I am currently able to use it almost exactly how I'd like. However I can't print integers or floats for some odd reason. Even if I use a conversion specifier like %d or %f I keep getting "no known conversion for const char [3] to int (or float, depending on which one I use)". Is there any way I can get the LCD to print floats?

Here is my code

void void1()
{
 float h= 42;
 lcd.begin(16, 2);              // start the library
 lcd.setCursor(0,0);
 lcd.print("Delay is"); // print a simple message
 lcd.print("%f",h);
}

Is there any way I can get the LCD to print floats?

Of course.

So, what IS lcd?

check - dtostrf() alternative for concatenating a float and a string - #4 by robtillaart - Programming Questions - Arduino Forum

Use dtostrf() and create a string to send to the LCD. sprintf() does not support floats on the arduino to save space.

obito94:
Is there any way I can get the LCD to print floats?

void void1()

{
float h= 42.24;
lcd.begin(16, 2);              // start the library
lcd.setCursor(0,0);
lcd.print("Delay is  "); // print a simple message
lcd.print(h);
}

Some food for thought..........

void void1()An interesting, if not very helpful name for a function.

float a = 22;
float b = 7;
float pie = a/b;
lcd_i2c.clear();
lcd_i2c.print(pie,32);

lcd_i2c.print(pie,32);

Printing a value that has 6 or 7 digits of precision to 32 decimal places makes NO sense.