How to print float number #include <LiquidCrystal.h>

hello I want to show float number in my LCD display but I don’t know how to do it…

… so I’m using that #include <LiquidCrystal.h> and this works fine for example :

lcd.print(“B = backwards”);

… but how to show numbers int and float numbers— something like that :

lcd.print("%1f ,volume "); this don’t work but I think it must be something like that…

I’ll be very pleased and lot of thanks if you can help me …

friendly regards Finland

-arto hautala -

Use lcd.print(myFloat,X) . X is the number of decimal places (1 to 6)

lcd.print(aFloatVariable, numberOfDecimalPlacesToPrint);

thank you !

that works fine !

thank you now it works fine !

I am glad that it worked for you

Which Arduino board are you using because there may be a different way to do what you want depending on the board

thank you , for good answer…

… I’m using arduino uno board … it’s good for my project …
… and I’m very pleased that arduino IDE works rather good … sometimes it falls down …
… but ctrl / delete helps … it’s not so bad …

… my project is pick and place for surface mount devices components (SMD)
… and there is vacuum pump and little vacuum chamber and stepper motor controlled paste
dispenser …
… please don’t hesitate to ask more of my project if you are interest

I’m very pleased for your help !

all the best for you
best regards

Then the alternative method of formatting would be more of a pain and can be memory hungry. Stick with what works now and good luck with your project

thank you … have a good time !

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.