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
- Committer:
- jmanocs
- Date:
- 2018-11-23
- Revision:
- 1:41d5b13f7fc5
- Parent:
- 0:dbffab632178
File content as of revision 1:41d5b13f7fc5:
#include "mbed.h"
#include "DHT11.h"
//Tested with success on STM32 Nucleo L476
DigitalIn mybutton(p20);
Serial pc(USBTX, USBRX);
DHT11 dht(p15);
int main() {
pc.printf("DHT11 Reader example\n");
while(1) {
if(mybutton == 0){
if(dht.readData() < 0){
pc.printf("Error while reading\n\r");
}
else{
pc.printf("Temperature:%d\n\r",dht.getTemperature());
pc.printf("Humidity:%d\n\r",dht.getHumidity());
}
}
}
}