
228 Chapter 12 • Doing the Math
If you are familiar with college math, you will recognize in m the slope of
the straight line that connects two points. Now our equation becomes:
Y = m x X – m x X
a
+ Y
a
As s, X
a
and Y
a
are all known constants, we compute a new term b as:
b = Y
a
– m x X
a
so our final equation becomes:
Y = m x X + b
This is the standard equation of a straight line in the Cartesian plane. Looking
back to our previous example, you can now compute m and b for your tempera-
ture sensor:
m = (50 – 0) / (450 – 200) = 0.2
b = 0 – 0.2 x 200 = –40
Y = 0.2 x X – 40
You can confirm your previous result:
Y = 0.2 x 315 – 40 = 23
Implementing this equation inside ...