
DHT11 ST MICRO STM32L476VGT YSU EET3735 FINAL LAB
Dependencies: BSP_DISCO_L476VG DHT LCD_DISCO_L476VG mbed
Fork of DHT11_STM32L476VGT_DISCO by
Revision 2:15a255321242, committed 2018-04-14
- Comitter:
- Camo330
- Date:
- Sat Apr 14 15:56:03 2018 +0000
- Parent:
- 1:aedc2645d841
- Child:
- 3:b348fbaadf02
- Commit message:
- This uses theSTM32L476VGTDI SCO KIT via the DHT11 sensor to read room temperature. The temperature can be read using Real Term or similar program.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Apr 21 07:02:29 2017 +0000 +++ b/main.cpp Sat Apr 14 15:56:03 2018 +0000 @@ -1,15 +1,24 @@ #include "mbed.h" #include "DHT.h" -#define DHT_DATA_PIN D4 + +// STM32L476VGT DISCOVERY BOARD +// DHT11 SENSOR RUNNING FROM 3V3 SUPPLY +// PULL DOWN WITH 10K RESISTOR +// DATA VIA THE PIN PA_0 +// COM PORT 4 AT 9600 BAUD + + +#define DHT_DATA_PIN PA_0 // sets pin PA_0 as data input -DHT sensor(DHT_DATA_PIN, DHT11); //DHT(PinName pin, eType DHTtype) +DHT sensor(DHT_DATA_PIN, DHT11); + //DHT(PinName pin, eType DHTtype) int main() { int error = 0; - float h = 0.0f, c = 0.0f, f = 0.0f, k = 0.0f, dp = 0.0f, dpf = 0.0f; - + float h = 0.0f, c = 0.0f, f = 0.0f, k = 0.0f, dp = 0.0f, dpf = 0.0f; + while(1) { wait(2.0f); //wait 2 second @@ -22,12 +31,14 @@ h = sensor.ReadHumidity(); dp = sensor.CalcdewPoint(c, h); dpf = sensor.CalcdewPointFast(c, h); - printf("Temperature in Kelvin: %4.2f, Celcius: %4.2f, Farenheit %4.2f\n", k, c, f); - printf("Humidity is %4.2f, Dewpoint: %4.2f, Dewpoint fast: %4.2f\n", h, dp, dpf); + printf("F: %4.2f, \r\n", f); //prints temp in farenheit to Real Term + // printf("H: %4.2f, \r\n", h); //prints humidity to Real Term + printf(" \r\n "); //acts as empty line to space readings in Real Term + printf(" \r\n "); //acts as empty line to space readings in Real Term } else //case: error { - printf("Error: %d\n", error); + printf("Error: %d\r\n", error); //prints error to Real Term when "if" criteria isn't satisfied } } } \ No newline at end of file
--- a/mbed.bld Fri Apr 21 07:02:29 2017 +0000 +++ b/mbed.bld Sat Apr 14 15:56:03 2018 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/7cff1c4259d7 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/994bdf8177cb \ No newline at end of file