[Tutor] Associate decimal values with an integer range

sparkle Plenty sparkle.plenty12481632 at gmail.com
Mon Apr 29 16:28:15 CEST 2013


Hi, I need some hints on where to start solving this problem.
I have to interpret a one-byte floating point number as a range between 0
and 240.  This is for a gui that controls an amplifier.  I am getting a
value such as 0.8367 from a fader control, and my Python is interpreting it
as either a 0 or 1.  I need to define this number to Python as an integer
value between 0 and 240.  I know that in hex I have the potential for
numbers from 0 to 255 within my one byte of available space, and the value
will be sent from gui to amp and back as a packed one-byte number.  I have
looked at the math module and so far, I am still stuck.

Alas, business calc was a long time ago, and I never studied logarithms.  I
expect the answer would be easier to find if I had more math.

I welcome all assistance.

Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130429/743da49c/attachment.html>


More information about the Tutor mailing list