avec fonctions

Dependencies:   DHT22 SSD1306 TCS34725 mbed

Fork of ProjetLong_Serre_V3 by Projet_Long_EI2I4

Revision:
2:4cf39fcca3f3
Parent:
1:6a83787ddf2d
--- a/main.cpp	Sun Oct 07 16:03:15 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-#include "mbed.h"
-#include "ssd1306.h"
-#include "standard_font.h"
-#include "bold_font.h"
-#include "DHT22.h"
-#include "Adafruit_TCS34725.h"
-
-//DEFINES
-#define commonAnode true
-
-void initRGB(int TCS);
-void GestionRGB();
-
-int r,g,b;
-
-SSD1306 oled(D9,D6,D10,A4,A6); // OLED : CS,Reset,DC,Clock,Data (SPI1)
-//I2C i2c(D4,D5);//SDA SCL
-//DigitalOut myled(LED1);//ATTENTION LED1 = D13
-DHT22 dht22(D4);
-Serial pc(USBTX, USBRX);
-//Adafruit_TCS34725 tcs = Adafruit_TCS34725(&i2c, TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X);
-
-AnalogIn sondeHum(A0);
-AnalogIn sondeTemp(A1);
-
-
-int main() {
-    
-    pc.printf("\n\r\tProjet SERRE : \n\r");  
-    pc.printf("\n\r\tCURIEL DKHEILA FURA\n\r\n\r");  
-                
-    float humAir=12.12;//Valeur d'init pour verifier pannes
-    float tempAir=13.13;
-    
-    float humSol=13.13;//Valeur d'init pour verifier pannes
-    float tempSol=13.13;
-    
-    oled.initialise();
-    oled.clear();
-    oled.set_contrast(255); // max contrast
-    oled.update();
-    
-    oled.clear();
-    oled.set_font(bold_font, 8);
-    oled.printf("Demarrage...\r\n");
-    oled.update();
-    
-    //initRGB(tcs.begin());   
-    wait(2.0);
-    oled.printf("OK\r\n");
-    oled.update();
-    
-    
-    while(1) {
-        
-      
-        wait(1.0); // 1 sec
-        
-        //HUM/TEMP AIR
-        dht22.sample() ;
-        humAir=dht22.getHumidity()/10.0;
-        tempAir=dht22.getTemperature()/10.0;
-        
-        //TEMP SOL        
-        
-        //AFFICHAGE
-        oled.clear();
-        
-        //AIR
-        oled.set_font(bold_font, 8);
-        oled.printf("AIR\r\n");
-        oled.set_font(standard_font, 6);
-        oled.printf("Humidite: %.2f %%\r\n", humAir);    
-        oled.printf("Temperature: %.2f C\r\n", tempAir); 
-        
-        pc.printf("AIR\r\n");
-        pc.printf("Humidite: %.2f %%\r\n", humAir);    
-        pc.printf("Temperature: %.2f C\r\n\r\n", tempAir); 
-        
-        //SOL
-        //tempSol=sondeTemp; //A MODIFIER!!!!!
-        humSol=sondeHum;//A MODIFIER !!!!!
-        oled.set_font(bold_font, 8);
-        oled.printf("SOL\r\n");
-        oled.set_font(standard_font, 6);
-        oled.printf("Humidite %.2f %\r\n", humSol); 
-        //oled.printf("Temperature %.2f C\r\n", tempSol);  
-        
-        
-       pc.printf("SOL\n\f");
-        pc.printf("Humidite: %.2f %%\r\n", humSol);    
-        //pc.printf("Temperature: %.2f C\r\n", tempSol); */
-        
-        //LUMINOSITE*/
-        
-        //RGB
-        //GestionRGB();
-        
-        
-        oled.update();
-        
-        
-        //printf("temp: %.2f C  , hum:%.2f %%    \n\r",temp,hum);
-        
-    }
-}
-
-void initRGB(int TCS)
-{
-    //---INIT RGB---
-    char gammatable[256];
-    if (TCS)
-    {
-        pc.printf("Found sensor");
-    }
-    else
-    {
-        pc.printf("No TCS34725 found ... check your connections");
-        while (1); // halt!
-    }
-    for (int i=0; i<256; i++)
-    {
-        float x = i;
-        x /= 255;
-        x = pow((double)x, 2.5);
-        x *= 255;
-        if (commonAnode)
-        {
-            gammatable[i] = 255 - x;
-        }
-        else
-        {
-            gammatable[i] = x;      
-        }
-        //printf("%d\r\n", gammatable[i]);
-    }
-    //---FIN INIT RGB---
-}
-
-
-/*void GestionRGB()
-{
-        uint16_t clear, red, green, blue;
-        tcs.setInterrupt(false);      // turn on LED
-        tcs.getRawData(&red, &green, &blue, &clear);
-        tcs.setInterrupt(true);  // turn off LED
-        //printf("%d, %d, %d, %d\r\n", clear, red, green, blue);
-        // Figure out some basic hex code for visualization
-        uint32_t sum = clear;
-        r = red; r /= sum;
-        g = green; g /= sum;
-        b = blue; b /= sum;
-        r *= 256; g *= 256; b *= 256;
-        pc.printf("R : %d, G : %d, B : %d\r\n",  r, g, b);
-        wait(2);    
-}*/
\ No newline at end of file