??? 03/10/09 14:44 Read: times |
#163299 - Yes, and your solution is in my code...perfect! Responding to: ???'s previous message |
It works great and adds a great nice piece of knowledgebase to my war chest......thank you!
I emailed you a question, not sure if you got it. Hopefully someone can chime in. I have a math problem. I plan to take the computed value of the speed (again working pefectly now) and pass that data into a function to light up a scaled 14 bar segment over a predefined range. My original thought process yielded: Bar_Value = (0x0E / (0x8C/SpeedCalculated)); // 140 used for testing And in retrospect, I found that I can't do fractional math (effectively) to make this work. I thought of a scale and offset with the limits of 0 - 140 but my divisor of 0x0E doesn't work as I want it to. Using speed range of 0 - 140MPH The thought is 0MPH = 0 Bars >>> 70 = 7 bars >>> 140 = 14 Bars I know this is something simple, and I just can't put my finger on it. All of my known methods bust or don't work properly. I was thinking of a fast lookup table but still is the computation aspect of the index that I'm stuck on. Anyone have some advise for a seemly easy problem? |