Plant Monitoring Project
Dependencies: mbed SHT21_ncleee WakeUp SSD1306 DHT Adafruit_TCS34725 DS1820
Diff: main.cpp
- Revision:
- 30:0a25c02e25d9
- Parent:
- 27:05fb631b1f6e
- Child:
- 31:45f4bfde0b9a
diff -r b1edf226ea9c -r 0a25c02e25d9 main.cpp --- a/main.cpp Tue Dec 03 15:36:50 2019 +0000 +++ b/main.cpp Wed Dec 11 17:26:05 2019 +0000 @@ -1,5 +1,6 @@ #include "main.hh" + int main(){ #ifdef OLED bouton.rise(interruption_bouton); @@ -86,24 +87,25 @@ #ifdef DEBUG pc.printf("Displaying Data\r\n"); #endif + if(!oled_on){ oled.wake(); + oled.clear(); oled_on = 1; } - oled.cls(0,1); - oled.locate(0,0); + oled.clear(); oled.printf("AIR T : %.1f", temperature_air); - oled.locate(1,0); + oled.printf("\n\r"); oled.printf("AIR H : %d", humidity_air); - oled.locate(3,0); + oled.printf("\n\r\n\r"); oled.printf("FLOOR T : %.1f", temperature_sol); - oled.locate(4,0); + oled.printf("\n\r"); oled.printf("FLOOR H : %d", humidity_sol); - oled.locate(6,0); + oled.printf("\n\r\n\r"); oled.printf("Light : %d", lum); - oled.locate(7,0); + oled.printf("\n\r"); oled.printf("R %d G %d B %d", pr, pg, pb); - oled.redraw(); + oled.update(); } #endif @@ -164,14 +166,24 @@ #ifdef OLED void initOLED(void){ - oled.wake(); - oled.init(); - oled.cls(0,1); - oled.locate(4,4); - oled.printf("2PA2S"); - oled.redraw(); - wait(1); - oled.cls(0,1); + oled.on(); + oled.initialise(); + oled.clear(); + oled.set_contrast(255); + oled.set_font(bold_font, 8); + oled.printf("================"); + oled.printf("\n\r"); + oled.printf(" 2PA2S"); + oled.printf("\n\r\n\r"); + oled.printf("FRAYSSE GERMAIN"); + oled.printf("\n\r\n\r"); + oled.printf(" DUPLESSIS"); + oled.printf("\n\r"); + oled.printf("================"); + oled.update(); + wait(10); + oled.clear(); + oled.update(); oled.sleep(); } #endif \ No newline at end of file