Plant Monitoring Project
Dependencies: mbed SHT21_ncleee WakeUp SSD1306 DHT Adafruit_TCS34725 DS1820
Diff: main.cpp
- Revision:
- 8:cbce19ac54b3
- Parent:
- 7:deb5dbe9e23d
- Child:
- 9:e4bed14db901
- Child:
- 10:80babe03d9c4
diff -r deb5dbe9e23d -r cbce19ac54b3 main.cpp --- a/main.cpp Tue Oct 08 18:22:15 2019 +0000 +++ b/main.cpp Wed Oct 09 17:36:26 2019 +0000 @@ -32,8 +32,8 @@ // Définition de fonctions float temp_sol(void); int fct_humidity_sol(void); -void fct_RGB(unsigned char *pr, unsigned char *pg, unsigned char *pb, unsigned short *lux); -void sendDataSigfox(float tempSol, unsigned char *humSol, float tempAir, unsigned char *humAir, unsigned short *lux, unsigned char *R, unsigned char *G, unsigned char *B); +void fct_RGB(void); +void sendDataSigfox(void); void oledData(void); void readData(void); @@ -67,7 +67,7 @@ oledData(); // Envoi des données sur le cloud - sendDataSigfox(temperature_sol, &humidity_sol, temperature_air, &humidity_air, &lum, &pr, &pg, &pb); + sendDataSigfox(); wait(10); } @@ -93,7 +93,7 @@ return (int) mesure_etalonnee; } -void fct_RGB(unsigned char *pr, unsigned char *pg, unsigned char *pb, unsigned short *lux) +void fct_RGB(void) { int somme; uint16_t clear, red, green, blue; @@ -104,20 +104,18 @@ } RGBsens.getRawData(&red, &green, &blue, &clear); somme = red + green + blue; - *pr = red*100/somme; - *pg = green*100/somme; - *pb = blue*100/somme; - *lux = clear; + pr = red*100/somme; + pg = green*100/somme; + pb = blue*100/somme; + lum = clear; } -void sendDataSigfox(float tempSol, unsigned char *humSol, float tempAir, unsigned char *humAir, unsigned short *lux, unsigned char *R, unsigned char *G, unsigned char *B){ +void sendDataSigfox(void){ short tempSol_short, tempAir_short; - tempSol *= 10; - tempAir *= 10; - tempSol_short = (short) tempSol; - tempAir_short = (short) tempAir; + 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, *humSol, tempAir_short, *humAir, *lux, *R, *G, *B); + 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){ @@ -143,7 +141,7 @@ humidity_sol = fct_humidity_sol(); temperature_air = sht.readTemp(); humidity_air = sht.readHumidity(); - fct_RGB(&pr, &pg, &pb, &lum); + fct_RGB(); }