Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "RHT03.h" //Include neede to use the RHT03 lib 00003 00004 int main() 00005 { 00006 int done=0; 00007 float temp,hum; 00008 00009 RHT03 humtemp(p24); //Initalise the RHT03 (change pin number to the pin its connected to) 00010 00011 while(!done) //Loop keeps running until RHT03 is read succesfully 00012 { 00013 wait(2); //Needed to make sure the sensor has time to initalise and so its not polled too quickly 00014 if(humtemp.readData() == RHT_ERROR_NONE) done=1; //Request data from the RHT03 00015 } 00016 00017 temp = humtemp.getTemperatureC(); //Gets the current temperature in centigrade 00018 hum = humtemp.getHumidity(); //Gets the current humidity in percentage 00019 00020 }
Generated on Thu Jul 14 2022 15:51:08 by
