I hope this makes sence,
I have an incomeing value anywhere from 0 to 65535. This represents 0 to 100%, 0 value being 0% and 65535 value being 100%. I need an equation that will take the incoming value and spit out a value that will be in 5% steps.
i.e
0% - 5% - 10% - 15% - etc
The actual output being, (rounded up)
0 - 3277 - 6553 - 9830 - etc
Or must I do
integer i = (Value_IN \ 3277) * 5;
if(i < 5)
i_Out = 0;
else if(i > 4 && < 10)
i_Out = 3277%;
etc
I would rather not do a string of if, else if unless I have to.
THANKS
I have an incomeing value anywhere from 0 to 65535. This represents 0 to 100%, 0 value being 0% and 65535 value being 100%. I need an equation that will take the incoming value and spit out a value that will be in 5% steps.
i.e
0% - 5% - 10% - 15% - etc
The actual output being, (rounded up)
0 - 3277 - 6553 - 9830 - etc
Or must I do
integer i = (Value_IN \ 3277) * 5;
if(i < 5)
i_Out = 0;
else if(i > 4 && < 10)
i_Out = 3277%;
etc
I would rather not do a string of if, else if unless I have to.
THANKS