Percentage
Posted: Tue Jun 30, 2020 3:59 pm
Hi Guys
I'm trying to display percentage on my LCD display the formula I'm using is Percentage = ((DutyCycle / 255) * 100) what happens it will display 100% (255 / 255) * 100 but will not display any other value eg Percentage = (( 253 / 255) * 100 ) which should give me 99.21 % except it gives me 0%, Percentage is a floating variable. Any ideas what I'm doing wrong
I'm trying to display percentage on my LCD display the formula I'm using is Percentage = ((DutyCycle / 255) * 100) what happens it will display 100% (255 / 255) * 100 but will not display any other value eg Percentage = (( 253 / 255) * 100 ) which should give me 99.21 % except it gives me 0%, Percentage is a floating variable. Any ideas what I'm doing wrong