White wizard Temperature and Humidity sensor module. See this page : http://wizard.nestegg.jp/thsensor.html
Diff: main.cpp
- Revision:
- 0:13b6d85b6dbd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Aug 02 17:57:16 2011 +0000 @@ -0,0 +1,35 @@ +//HIH-5031 +//0% = 0.6V +//80% = 2.0V +//H% = (80-0)/(2-0.6)*(Vout-0.6V) + +//MCP9700 +//0C = 0.5V +//100C = 1.5V +//T = 100*(Vout-0.5V) + +#include "mbed.h" + +DigitalOut myled(LED1); +AnalogIn ad19(p19); +AnalogIn ad20(p20); + +int main() { + float ADdata19,ADdata20,temp,humid; + + while(1) { + ADdata19 = ad19.read()*3.3; + ADdata20 = (ad20.read()*3.3); + + //temp = ((ADdata20*1000.0)-500.0)/10.0;//temp + temp = 100*(ADdata20-0.5);//temp + //humid = 43.24*(ADdata19-0.4); + humid = (80.0/1.4)*(ADdata19-0.6); + + printf("p19 = %f V, p20 = %f V , H = %f , T = %f C \n", ADdata19, ADdata20, humid, temp); + myled = 1; + wait(0.2); + myled = 0; + wait(0.2); + } +}