Plant Monitoring Project
Dependencies: mbed SHT21_ncleee WakeUp SSD1306 DHT Adafruit_TCS34725 DS1820
Revision 30:0a25c02e25d9, committed 2019-12-11
- Comitter:
- Germaint
- Date:
- Wed Dec 11 17:26:05 2019 +0000
- Parent:
- 28:b1edf226ea9c
- Child:
- 31:45f4bfde0b9a
- Commit message:
- Nouvel ecran et nouveaux pins
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SSD1306.lib Wed Dec 11 17:26:05 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/Byrn/code/SSD1306/#1d9df877c90a
--- a/define.hh Tue Dec 03 15:36:50 2019 +0000 +++ b/define.hh Wed Dec 11 17:26:05 2019 +0000 @@ -1,9 +1,9 @@ #pragma once //#define DEBUG -#define SIGFOX -#define FLOOR_TEMPERATURE -#define FLOOR_HUMIDITY -#define AIR_PARAMETERS -#define RGB +// #define SIGFOX +//#define FLOOR_TEMPERATURE +//#define FLOOR_HUMIDITY +//#define AIR_PARAMETERS +//#define RGB #define OLED
--- 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
--- a/main.hh Tue Dec 03 15:36:50 2019 +0000 +++ b/main.hh Wed Dec 11 17:26:05 2019 +0000 @@ -6,6 +6,8 @@ #include "SHT21_ncleee.h" #include "Adafruit_TCS34725.h" #include "ssd1306.h" +#include "standard_font.h" +#include "bold_font.h" #define DUREE_OFF 10 // Durée en seconde entre deux mesures #define DUREE_ECRAN_ON 5 // Durée en seconde d'éveil de l'écran @@ -23,17 +25,19 @@ Serial wisol(D1,D0); #endif -I2C i2c(I2C_SDA, I2C_SCL); +I2C i2c_1(I2C_SDA, I2C_SCL); +I2C i2c_2(D12,A6); #ifdef OLED -SSD1306 oled(D12, A6); +// D6 D9 D10 A4 D2 +SSD1306 oled(PB_1, PA_8, PA_11, PA_5, PA_12); #endif -InterruptIn bouton(D10); +InterruptIn bouton(A2); // Capteurs #ifdef FLOOR_TEMPERATURE -DS1820 DS(D2); // temperature sol +DS1820 DS(A3); // temperature sol #endif #ifdef FLOOR_HUMIDITY @@ -41,11 +45,11 @@ #endif #ifdef AIR_PARAMETERS -SHT21 sht(&i2c); // humidité + température air +SHT21 sht(&i2c_1); // humidité + température air #endif #ifdef RGB -Adafruit_TCS34725 RGBsens = Adafruit_TCS34725(&i2c, TCS34725_INTEGRATIONTIME_154MS, TCS34725_GAIN_1X); // RGB +Adafruit_TCS34725 RGBsens = Adafruit_TCS34725(&i2c_2, TCS34725_INTEGRATIONTIME_154MS, TCS34725_GAIN_1X); // RGB #endif // Fonctions
--- a/ssd1306_library.lib Tue Dec 03 15:36:50 2019 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://os.mbed.com/users/Germaint/code/ssd1306_library/#e5341e7eb825