Tristan Hughes
/
RHT03_HelloWorld
A sample program showing how to read data from the RHT03
Revision 0:4c2df3ab072c, committed 2012-08-29
- Comitter:
- tristanjph
- Date:
- Wed Aug 29 09:23:38 2012 +0000
- Child:
- 1:567ee42e14cb
- Commit message:
- Initial commit
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RHT03.lib Wed Aug 29 09:23:38 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/tristanjph/code/RHT03/#2bd5cffd60d0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Aug 29 09:23:38 2012 +0000 @@ -0,0 +1,20 @@ +#include "mbed.h" +#include "RHT03.h" //Include neede to use the RHT03 lib + +int main() +{ + int done=0; + float temp,hum; + + RHT03 humtemp(p24); //Initalise the RHT03 (change pin number to the pin its connected to) + + while(!done) //Loop keeps running until RHT03 is read succesfully + { + wait(2); //Needed to make sure the sensor has time to initalise and so its not polled too quickly + if(humtemp.readData() == RHT_ERROR_NONE) done=1; //Request data from the RHT03 + } + + temp = humtemp.getTemperatureC(); //Gets the current temperature in centigrade + hum = humtemp.getHumidity(); //Gets the current humidity in percentage + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Aug 29 09:23:38 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/10b9abbe79a6 \ No newline at end of file