bayern

Dependencies:   mbed DHT22

Files at this revision

API Documentation at this revision

Comitter:
svupper
Date:
Wed Jan 16 12:45:50 2019 +0000
Parent:
0:76148ffba877
Commit message:
bayern

Changed in this revision

DHT22.lib Show annotated file Show diff for this revision Revisions of this file
Sigfox_Com.lib Show diff for this revision Revisions of this file
SoftSerial.lib Show diff for this revision Revisions of this file
SoftSerial_IR.lib Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 76148ffba877 -r cfd64ae75009 DHT22.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DHT22.lib	Wed Jan 16 12:45:50 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/Julepalme/code/DHT22/#7fd3ff04ae95
diff -r 76148ffba877 -r cfd64ae75009 Sigfox_Com.lib
--- a/Sigfox_Com.lib	Tue Jan 15 15:20:53 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://os.mbed.com/users/Sidibe/code/Sigfox_Com/#3ef537a95c15
diff -r 76148ffba877 -r cfd64ae75009 SoftSerial.lib
--- a/SoftSerial.lib	Tue Jan 15 15:20:53 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://os.mbed.com/users/Sissors/code/SoftSerial/#a0029614de72
diff -r 76148ffba877 -r cfd64ae75009 SoftSerial_IR.lib
--- a/SoftSerial_IR.lib	Tue Jan 15 15:20:53 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://os.mbed.com/users/kenjiArai/code/SoftSerial_IR/#dc766032cdd6
diff -r 76148ffba877 -r cfd64ae75009 main.cpp
--- a/main.cpp	Tue Jan 15 15:20:53 2019 +0000
+++ b/main.cpp	Wed Jan 16 12:45:50 2019 +0000
@@ -1,69 +1,77 @@
 #include "mbed.h"
 #include <iostream>
-#include "sigfox.h"
-#include "SoftSerial.h"
+#include "DHT22.h"
+#include "string.h"
+
 using namespace std;
 
-DigitalOut myled(D2);
-Serial sc(SERIAL_TX, SERIAL_RX, 9600);
-//Serial device(PA_9, PA_10);
-SoftSerial device(PA_4, PA_5);
+Serial pc(USBTX, USBRX, 9600);
+DHT22 dht22(D3);
+
+//Serial device(PA_6, PA_7);
+//Serial device(A7, A2);
+//Serial device(PB_6, PB_7);
+//Serial device(PB_7, PB_6);
+Serial device(PA_9, PA_10);
+//Serial device(PA_2, PA_15);
+//SoftSerial device(PA_4, PA_5);
+//SoftSerial_IR device(PB_6, PB_7);
 //Serial sc2(D5, D4);
 
+void test(){
+    pc.printf("---New Call ---\r\n");
+    
+    if(device.writeable()) { 
+        pc.printf("Device writeable\r\n");
+    }
 
-int main() {
-    device.baud(9600);
-    sc.printf("---New start ---\r");
-    while (!device.writeable()) { }
-    sc.printf("Device writeable\r\n");
-    Sigfox_ mySigfox;
+    /* Debut Test Communication*/
     
     device.printf("AT\r");
 
-    char a = device.getc();
-    char b = device.getc();
-    sc.printf("%c%c \n", a, b);
-    sc.printf("%c", device.getc());
-   
-    
-    uint8_t i = 0;
+    }
     
-    char res[]= {'1','1','2','2','3','4','1','6','4','2'};
-    int res_[]= {1,1,2,2,3,4,1,6,6,2};
-    char res_1[]= {'a', 'b', 'c'};
-    int var = 1;
+    void read(){
+        char temp;
+        do{
+            temp = device.getc();
+            pc.printf("%c", temp);
+        }while(temp != ';');    
+    }
     
+    void send(char c[]){
+        
     char donnee[] = "AT$SF=";
-    //char send[] = "123456789098";
+    strcat(donnee,c);
+    strcat(donnee,"\r");
     device.printf(donnee);
-    device.printf("%x",79);
-    //wait_ms(100);
-    device.printf("%x",3249981468);
-   // wait_ms(100);
-    device.printf("%x",3258733844);
-    device.printf("\r");
+    pc.printf(donnee);
+    }
 
-    char temp;
-    do{
-        wait(1.0);
-        temp = device.getc();
-        sc.printf("%c%", temp);
-    } while(temp != ';');
+int main() {
+    int humidite;  
+    int temperature;  
+    char c[] = "fff";
+    device.baud(9600);
+    
+    test();
+    read();
     
-    
-   
-    sc.printf("hhh");
-   
     while(1) {
-       if(device.readable() > 0){
-        temp = device.getc();
-        wait(3.0);
-        sc.printf("%c%", temp);
-       }
-       myled = 1;
-       wait(0.2);
-       myled = 0; 
-       wait(1.0);
+                
+        dht22.sample() ;
+        humidite=dht22.getHumidity()/10.0;
+        temperature=dht22.getTemperature()/10.0;
+        pc.printf("temperature: %d humidity: %d\n\r",temperature,humidite);
+        
+        wait(1); 
+        
+        //char c = humidite+'0';
+        
+        send(c);
+        wait(100.0);
+
     }
 }
 
+