This is a very basic (hopefully easily understandeable) program to send the data bits of a DHT11 temperature and humidity sensor through Nucleo UART. It is a simple step-by-step guide to build the program.
Dependencies: mbed
Fork of DHT11_with_Nucleo by
Diff: main.cpp
- Revision:
- 10:774c12ebf0f2
- Parent:
- 9:a2918c6c37ee
- Child:
- 11:1379308ecace
--- a/main.cpp Tue Jan 13 18:54:14 2015 +0000 +++ b/main.cpp Wed Jan 14 13:11:36 2015 +0000 @@ -48,8 +48,12 @@ myled = 1; // LED is ON dht_read(); // Call the function // Send result through UART result - pc.printf("%X",adat); + pc.printf("%X", (adat & 0x000000ffff000000) >> 24); // Humidity pc.printf("\n\r"); // Send a new line and carriage return. + pc.printf("%X", (adat & 0x0000000000ffff00) >> 8 ); // Temperature + pc.printf("\n\r"); + pc.printf("%X", adat & 0x00000000000000ff); // Checksum. + pc.printf("\n\r"); wait_ms(200); // Wait 0.2 sec till continue. } else { myled = 0; // LED is OFF