Plant Monitoring Project

Dependencies:   mbed SHT21_ncleee WakeUp SSD1306 DHT Adafruit_TCS34725 DS1820

Revision:
13:80730bea52de
Parent:
12:ad8d26614e1e
Child:
14:037b74ba42c7
diff -r ad8d26614e1e -r 80730bea52de main.cpp
--- a/main.cpp	Tue Oct 15 15:48:58 2019 +0000
+++ b/main.cpp	Mon Oct 21 07:04:22 2019 +0000
@@ -70,13 +70,8 @@
     oled.cls();
     oled.off();
     // Initialisation des mesures 
-    capture.attach(&readData,DUREE_MESURE);
-    // Initialisation capteur lumière
-    if (!RGBsens.begin())
-    {
-        pc.printf("No TCS34725 found ... check your connections");
-        while (1); // halt!
-    }
+    capture.attach(&readData,DUREE_MESURE);    
+    
     //Initialisation de l'interruption
     bouton.fall(interruption_bouton);
     readData();
@@ -109,22 +104,26 @@
 {
     int somme;
     uint16_t clear, red, green, blue;
-    
-        RGBsens.getRawData(&red, &green, &blue, &clear);
-        somme = red + green + blue;
-        pr = red*100/somme;
-        pg = green*100/somme;
-        pb = blue*100/somme;
-        lum = clear;
+    if (!RGBsens.begin())
+    {
+        pc.printf("No TCS34725 found ... check your connections");
+        //while (1); // halt!
+    }
+    RGBsens.getRawData(&red, &green, &blue, &clear);
+    somme = red + green + blue;
+    pr = red*100/somme;
+    pg = green*100/somme;
+    pb = blue*100/somme;
+    lum = clear;
 }
 
 void sendDataSigfox(void){
-        short tempSol_short, tempAir_short;
-        tempSol_short = (short)(temperature_sol*10);
-        tempAir_short = (short)(temperature_air*10);
+    short tempSol_short, tempAir_short;
+    tempSol_short = (short)(temperature_sol*10);
+    tempAir_short = (short)(temperature_air*10);
 
-        nucleo.printf("AT$SF=%04x%02x%04x%02x%04x%02x%02x%02x\r\n",tempSol_short, humidity_sol, tempAir_short, humidity_air, lum, pr, pg, pb);
-    }
+    nucleo.printf("AT$SF=%04x%02x%04x%02x%04x%02x%02x%02x\r\n",tempSol_short, humidity_sol, tempAir_short, humidity_air, lum, pr, pg, pb);
+}
     
 void oledData(void){
     if(!oled_on){
@@ -158,7 +157,7 @@
     humidity_sol = fct_humidity_sol();
     temperature_air = sht.readTemp();
     humidity_air = sht.readHumidity();
-    //fct_RGB();
+    fct_RGB();
     sendDataSigfox();
     if(oled_on)
         oledData();