ESCLAVO EN COMUNICACIÓN RF MEDIANTE XBEE

Dependencies:   DHT mbed

Files at this revision

API Documentation at this revision

Comitter:
Luisv
Date:
Sat Jun 03 16:03:58 2017 +0000
Commit message:
ESCLAVO

Changed in this revision

DHT.lib Show annotated file Show diff for this revision Revisions of this file
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 000000000000 -r a9edb2087606 DHT.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DHT.lib	Sat Jun 03 16:03:58 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/Wimpie/code/DHT/#9b5b3200688f
diff -r 000000000000 -r a9edb2087606 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Jun 03 16:03:58 2017 +0000
@@ -0,0 +1,53 @@
+//ESCLAVO//
+#include "mbed.h"
+#include "DHT.h"
+#include <string>
+
+Serial pc(USBTX,USBRX);
+Serial TxRx(D14, D15);
+DHT sensor(D4, DHT11);
+DigitalOut Reset(A2);
+
+float medida, sens, sens1;
+char humedad[10], temp[10];
+char r1[125], r2[125];
+string Texto1, Texto2;
+
+int main()
+{
+    Reset = 0;
+    wait(0.1);
+    Reset = 1;
+    
+    pc.printf("Esclavo Invocado\n\r");
+    while(1)
+    {
+        medida=sensor.readData();
+        sens = sensor.ReadHumidity();
+        sens1 = sensor.ReadTemperature(CELCIUS);
+        sprintf(temp,"%.2f",sens1);
+        sprintf(humedad,"%.2f",sens);
+        string str1(temp);
+        string str(humedad);
+        do
+        {
+            //while(TxRx.readable() == 1)
+            {
+                Texto1 = "";
+                TxRx.gets(r1,5);
+                Texto1 += r1;
+                wait(0.001);
+            }
+        }while(Texto1 == "");
+        if(Texto1 =="0033")
+        {
+            pc.printf("Enviando....\n\r");
+            TxRx.printf("%s\n",str1);
+            wait(0.1);
+            TxRx.printf("%s\n",str);      
+            pc.printf("temperatura:%s\n\r",str1);
+            pc.printf("humedad:%s\n\r",str);       
+        }
+        Texto1 = "";
+    }
+}
diff -r 000000000000 -r a9edb2087606 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Jun 03 16:03:58 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/86740a56073b
\ No newline at end of file