UPS MAESTRIA

Dependencies:   mbed DHT

El sensor DHT11 es un sensor conexión es trivial, pero cabe destacar que se vende en dos encapsulados, uno de tres pines que son GND, Data y Vcc, y otro 4 pines y uno de ellos, sencillamente sobra y no se conecta. Normalmente viene rotulado en el sensor el nombre de cada pin.

https://os.mbed.com/media/uploads/flozada/dht11_3pins__-162x300.png

https://os.mbed.com/media/uploads/flozada/dht11.png

Files at this revision

API Documentation at this revision

Comitter:
flozada
Date:
Thu Feb 06 22:18:39 2020 +0000
Parent:
3:cd7804120497
Commit message:
PROTOTIPO CODIGO CON SENSOR DHT11_ TEMPERATURA Y HUMEDAD

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
diff -r cd7804120497 -r efa40de4c07e main.cpp
--- a/main.cpp	Sat Jan 07 22:34:55 2017 +0000
+++ b/main.cpp	Thu Feb 06 22:18:39 2020 +0000
@@ -1,8 +1,8 @@
 
 #include "mbed.h"
 #include "DHT.h"
-
-DHT sensor(D7, DHT22);
+Serial device(PA_2,PA_3);
+DHT sensor(PD_7, DHT22);
 
 int main()
 {
@@ -13,17 +13,18 @@
        wait(2.0f);
         error = sensor.readData();
         if (0 == error) {
+            device.baud(115200);
             c   = sensor.ReadTemperature(CELCIUS);
             f   = sensor.ReadTemperature(FARENHEIT);
             k   = sensor.ReadTemperature(KELVIN);
             h   = sensor.ReadHumidity();
             dp  = sensor.CalcdewPoint(c, h);
             dpf = sensor.CalcdewPointFast(c, h);
-            printf("Temperature in Kelvin: %4.1f, Celcius: %4.1f, Farenheit %4.1f\n", k, c, f);
-            printf("Humidity is %4.1f, Dewpoint: %4.1f, Dewpoint fast: %4.1f\n", h, dp, dpf);
-            printf("\n");
+            device.printf("Temperature in Kelvin: %2.1f, Celcius: %2.1f, Farenheit %2.1f\n", k, c, f);
+            device.printf("Humidity is %2.1f, Dewpoint: %2.1f, Dewpoint fast: %2.1f\n", h, dp, dpf);
+            device.printf("\n");
         } else {
-            printf("Error: %d\n", error);
+            device.printf("Error: %d\n", error);
         }
     }
 }
diff -r cd7804120497 -r efa40de4c07e mbed.bld
--- a/mbed.bld	Sat Jan 07 22:34:55 2017 +0000
+++ b/mbed.bld	Thu Feb 06 22:18:39 2020 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/99b5ccf27215
\ No newline at end of file
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file