
578 Appendix D • Math Cheat Sheet
Sensors
Raw values to percentage (light sensor):
percentage = 146 – raw value / 7
Raw values to temperatures, in C° (temperature sensor):
C° = (785 – raw value) / 8
Conversion of Celsius to Fahrenheit degrees:
F° = C° x 9 / 5 + 32
Averages
Simple average:
A = (V
1
+ V
2
+… + V
n
) / n
Weighted average:
A = (V
1
x W
1
+ V
2
x W
2
+ … + V
n
x W
n
) / (W
1
+ W
2
+ ... + W
n
)
Exponential smoothing:
A
n
= (V
n
x W
1
+ A
n-1
x W
2
) / (W
1
+ W
2
)
Interpolation
Linear interpolation: Find the value of ...