I'm developing system that will showing output on LCD.
I declare variable data type as float, but the LCD display showing 0.00 that I don't initialize, because I declare it with 0.0
I want the LCD display showing 0.000, but whatever I try to change the initialize value the LCD Display always showing 0.00
.So, how I can make the LCD Display showing 0.000
This is the link for the image
Below are my code:
#include <LiquidCrystal.h>
volatile int NbTopsFan;
float flowrate = 0.0;
float volume = 0.0;
int hallSensor = 2;
LiquidCrystal lcd (12, 11, 9, 8, 7, 6);
void rpm() {
NbTopsFan++;
}
void setup(){
pinMode(3, OUTPUT);
pinMode (hallSensor, INPUT);
Serial.begin (9600);
attachInterrupt (0, rpm, RISING);
lcd.begin (16, 2);
lcd.clear ();
}
void loop (){
digitalWrite(3, HIGH);
NbTopsFan=0;
sei();
delay(1000);
cli();
flowrate = NbTopsFan / 7.5;
volume += (flowrate / 60);
lcd.clear ();
lcd.setCursor(0, 0);
lcd.print("flow :");
lcd.print(flowrate);
lcd.print("L/m");
lcd.setCursor(0, 1);
lcd.print("VOl :");
lcd.print(volume);
lcd.print("L");
Serial.print("Pulse");
Serial.print(NbTopsFan);
Serial.print(flowrate);
Serial.print("L/m");
Serial.print(volume,4);
Serial.print("liter");
}