HIH-4030 fork to handle 3.3v input voltage
Fork of HIH-4030 by
hih-4030.cpp@1:f0ae84350631, 2013-08-11 (annotated)
- Committer:
- ddollar
- Date:
- Sun Aug 11 19:58:52 2013 +0000
- Revision:
- 1:f0ae84350631
- Parent:
- 0:114b50b41972
tweak for 3.3v
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
simonbarker | 0:114b50b41972 | 1 | #include "hih-4030.h" |
simonbarker | 0:114b50b41972 | 2 | |
ddollar | 1:f0ae84350631 | 3 | HIH4030::HIH4030(PinName pin) { |
ddollar | 1:f0ae84350631 | 4 | m_analog_in = new AnalogIn(pin); |
simonbarker | 0:114b50b41972 | 5 | } |
simonbarker | 0:114b50b41972 | 6 | |
simonbarker | 0:114b50b41972 | 7 | float HIH4030::sensorRH(){ |
ddollar | 1:f0ae84350631 | 8 | return (((m_analog_in->read() * 3.3) - 0.631) / 0.0307); |
simonbarker | 0:114b50b41972 | 9 | } |
simonbarker | 0:114b50b41972 | 10 | |
simonbarker | 0:114b50b41972 | 11 | float HIH4030::trueSensorRH(float temperature){ |
ddollar | 1:f0ae84350631 | 12 | return (sensorRH() / (1.0546 - (temperature * 0.00216))); |
simonbarker | 0:114b50b41972 | 13 | } |