To display a bar, i want to calculate the percent of an operation
Sample time is stored in a variable "m2_sampleTime" in Minutes! When a new cycle is started, "m2_logStart" is filled with millis();
Since this updates a display and should not called over and over (flickering) i only call it per 2 seconds. Im calling this code, i added serial prints to debug.
float m2_barCalc_float = (100/(m2_sampleTime*60000))*(millis()-m2_logStart); Serial.println(m2_barCalc_float); byte m2_barCalc = m2_barCalc_float; Serial.println(m2_barCalc);
In the normal operation this code would be followed by the display code, but thats not needed here.
I only need full % like 1% not 1.234% or so.
Serial Ouptut is always 0.00 followed by 0 for the byte?
Why and how to fix?