![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Plant Monitoring Project
Dependencies: mbed SHT21_ncleee WakeUp SSD1306 DHT Adafruit_TCS34725 DS1820
Diff: main.cpp
- Revision:
- 27:05fb631b1f6e
- Parent:
- 26:5d38b3abb89a
- Child:
- 29:29df6820812c
- Child:
- 30:0a25c02e25d9
--- a/main.cpp Mon Dec 02 10:19:02 2019 +0000 +++ b/main.cpp Tue Dec 03 15:36:17 2019 +0000 @@ -1,8 +1,6 @@ #include "main.hh" int main(){ - #ifdef DEEPSLEEP - #endif #ifdef OLED bouton.rise(interruption_bouton); initOLED(); @@ -10,16 +8,11 @@ while(1) { readData(); - #ifdef DEEPSLEEP - - #endif - #ifndef DEEPSLEEP wait(DUREE_OFF); - #endif } } - +#ifdef FLOOR_TEMPERATURE float temp_sol() { DS.convertTemperature(true, DS1820::all_devices); @@ -33,9 +26,9 @@ #endif return DS.temperature(); } - +#endif - +#ifdef FLOOR_HUMIDITY int fct_humidity_sol(void) { float val_min = 0.377; @@ -48,8 +41,9 @@ #endif return (int) mesure_etalonnee; } +#endif - +#ifdef RGB void fct_RGB(void) { int somme; @@ -72,7 +66,9 @@ pc.printf("rouge:%d vert:%d bleu:%d \n\r", pr, pg, pb); #endif } +#endif +#ifdef SIGFOX void sendDataSigfox(void){ #ifdef DEBUG pc.printf("Sending Data to Sigfox \n\r"); @@ -83,7 +79,9 @@ wisol.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); } - +#endif + +#ifdef OLED void oledData(void){ #ifdef DEBUG pc.printf("Displaying Data\r\n"); @@ -107,6 +105,7 @@ oled.printf("R %d G %d B %d", pr, pg, pb); oled.redraw(); } +#endif void readData(void){ #ifdef DEBUG @@ -143,13 +142,16 @@ #ifdef DEBUG pc.printf("Button interrupt\r\n"); #endif + #ifdef OLED if(!oled_on){ oledData(); timeScreen.attach(&turnOffScreen,DUREE_ECRAN_ON); } + #endif bouton.enable_irq(); } +#ifdef OLED void turnOffScreen(void){ #ifdef DEBUG pc.printf("Turning off screen \n\r"); @@ -158,7 +160,9 @@ oled_on = 0; oled.sleep(); } +#endif +#ifdef OLED void initOLED(void){ oled.wake(); oled.init(); @@ -169,4 +173,5 @@ wait(1); oled.cls(0,1); oled.sleep(); -} \ No newline at end of file +} +#endif \ No newline at end of file