DHT11 sensor test for Stage 1 Engineering at the University of York
Dependencies: DHT11 UoY-serial
main.cpp
00001 #include "mbed.h" 00002 #include "UoY-serial.h" 00003 #include "DHT11.h" 00004 00005 // D2 is the data pin name on the Nucleo board 00006 DHT11 sensor(D2); 00007 00008 int main() 00009 { 00010 while(true) { 00011 // Print temperature and humidity 00012 printf("Temp: %d\n", sensor.readTemperature()); 00013 printf(" RH: %d%%\n", sensor.readHumidity()); 00014 00015 // Wait 2 seconds before doing it again 00016 thread_sleep_for(2000); 00017 } 00018 } 00019
Generated on Fri Jul 15 2022 06:07:36 by 1.7.2