mbed-os github

Dependencies:   ADS1015 Faulhaber HTU21D_mod MS5837_potless Sensor_Head_RevB_3 USBDevice_dfu Utilsdfu beep

Fork of ARNSRS_testDFU by POTLESS

Revision:
0:69d4b21d58e0
Child:
1:bef7856b5c0a
diff -r 000000000000 -r 69d4b21d58e0 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Apr 29 01:26:37 2017 +0000
@@ -0,0 +1,35 @@
+#include "mbed.h"
+
+Serial serialCozir (PA_9,PA_10,9600);
+Serial serialMonit (USBTX,USBRX,9600);
+int co2=0;
+char buffer[6];
+
+
+
+    
+
+
+int requestCO2() {
+    int result = 0;
+    int i;
+    // demander les ppm de CO2 au capteur (Z majuscule lire notice) en mode pooling    
+    
+    serialCozir.printf("Z\r\n");
+    while (serialCozir.getc() != 'Z' ) { // on attend la réponse en Z majuscule
+         }
+         
+    for (i=1;i<6;i++){
+        buffer[i]=serialCozir.getc();
+        }
+      buffer[i] = '\0';
+      atoi(&buffer[6]);  
+    return result;
+}
+
+
+int main(){
+    serialMonit.printf("co2 = %d\r\n",requestCO2);
+    wait (1);
+    
+    }
\ No newline at end of file