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:
8:a750d531b381
Parent:
7:ad15c386e960
Child:
9:04bfdfc029cb
--- a/main.cpp	Wed Aug 02 06:01:03 2017 +0000
+++ b/main.cpp	Wed Sep 27 08:02:47 2017 +0000
@@ -1,6 +1,7 @@
 #include "mbed.h"
 #include <string>
 #include "Sensor_head_revB.h"
+#include "HTU21D.h"
 
 //Moniteur série
 Serial serialMonit (USBTX,USBRX,9600);
@@ -26,6 +27,17 @@
 Timer REAL_RATE;
 float RATE = 0;
 
+//HTU21D
+HTU21D temphumid(PB_9, PB_8); //Temp humid sensor || SDA, SCL
+int sample_ftemp;
+float sample_ctemp;
+int sample_ktemp;
+int sample_humid;
+
+//VT100
+static const char CLS[] = "\x1B[2J";
+static const char HOME[] = "\x1B[H";
+
 //Thread d'intérogation des capteurs
 Thread thread;
 
@@ -43,18 +55,44 @@
         //Cell O2 en mV
         CellO2_1 = sensors.requestCellO2_1();
         CellO2_2 = sensors.requestCellO2_2();
+        
+        //HTU21D
+        //sample_ftemp = temphumid.sample_ftemp();
+        sample_ctemp = temphumid.sample_ctemp();
+        //sample_ktemp = temphumid.sample_ktemp();
+        sample_humid = temphumid.sample_humid();
     }
 }
 
 void Affichage_moniteur()
 {
-    printf("  CO2           = %d\r\n"  , co2);
-    printf("  Pression      = %f\r\n", pression);
-    printf("  Temperature   = %f\r\n", Temp);
-    printf("  PPO2          = %d\r\n", ppO2);
-    printf("  Cell O2 n 1   = %d\r\n"  , CellO2_1);
-    printf("  Cell O2 n 2   = %d\r\n"  , CellO2_2);
+    
+    printf("  CO2             = %d\r\n"  , co2);
+    printf("  PPO2            = %d\r\n", ppO2);
+    printf("  Pression        = %f\r\n", pression);
+    printf("  Temperature 1   = %f\r\n", Temp);
+    printf("  Temperature 2   = %f C\n\r", sample_ctemp);
+    printf("  Humidity        = %d %%\n\r", sample_humid);
+    printf("\n\r");
+    printf("  Cell O2 n 1     = %d\r\n"  , CellO2_1);
+    printf("  Cell O2 n 2     = %d\r\n"  , CellO2_2);
     printf("\r\n");
+    
+    //printf("Temperature: %d F\n\r", sample_ftemp);    
+    //printf("Temperature: %d K\n\r", sample_ktemp);    
+    
+   
+    /*
+    printf(HOME);
+    printf("\x1b[30m");
+    printf("\x1b[0m\r  CO2          = \x1b[1m\x1b[K%d\n", co2);
+    printf("\x1b[0m\r  Pression     = \x1b[1m\x1b[K%f\n", pression);
+    printf("\x1b[0m\r  Temperature  = \x1b[1m\x1b[K%f\n", Temp);
+    printf("\x1b[0m\r  PPO2         = \x1b[1m\x1b[K%d\n", ppO2);
+    printf("\x1b[0m\r  Cell O2 n 1  = \x1b[1m\x1b[K%d\n", CellO2_1);
+    printf("\x1b[0m\r  Cell O2 n 2  = \x1b[1m\x1b[K%d\n", CellO2_2);
+    printf("\n");
+    */
 }
 
 //Callback de l'intérruption des envois de commandes au Cozir
@@ -74,7 +112,7 @@
 
 int main()
 {
-     set_time(1256729737);
+    set_time(1256729737);
     
     sensors.Sensors_INIT(false, false, 5, SPOOLING, DIGI_FILTER32, CALIB_AIR);
 
@@ -86,6 +124,8 @@
     
     thread.set_priority(osPriorityRealtime);
     
+    printf(CLS);
+    
     while (true) {
 
         //Démarrage du Timer mesurant le temps d'éxecution du code
@@ -111,7 +151,7 @@
         RATE = REAL_RATE.read();
         //Reset du Timer
         REAL_RATE.reset();
-        printf("\r\n  Temps d'exécution de la boucle = %f\r\n", RATE);
+        printf("\r\n  Temps d execution de la boucle = %f\r\n", RATE);
         printf("\r\n", "");
         
     }