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:
- 4:62b680fac6ed
- Parent:
- 3:6228ab73d420
- Child:
- 5:76a9332af64c
--- a/main.cpp Tue Jan 06 00:10:33 2015 +0000 +++ b/main.cpp Tue Jan 06 00:48:44 2015 +0000 @@ -3,6 +3,8 @@ DigitalOut myled(LED1); // Activate LED DigitalIn mybutton(USER_BUTTON); // Activate button DigitalInOut data_pin(A0); // Activate digital in +Serial pc(SERIAL_TX, SERIAL_RX); // Initialize UART connection +// Use a terminal program (eg. TeraTerm). // Function to initialize DHT11 void dht_read(void) { @@ -12,10 +14,11 @@ wait_ms(20); // After high and release the pin switch input mode data_pin = 1; - data_pin.input(); + data_pin.input(); } int main() { + pc.printf("Read the DHT11 temperature and humidity sensor!\n"); //Welcome message while(1) { if (mybutton == 0) { // Button is pressed myled = 1; // LED is ON