Sigfox project
Dependencies: mbed TCS34725 WakeUp DHT TSL2561_I2C DS1820
Revision 5:59c1c70635c3, committed 2020-01-20
- Comitter:
- ran_ghe
- Date:
- Mon Jan 20 12:41:12 2020 +0000
- Parent:
- 4:0b63b5897827
- Commit message:
- final
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Jan 20 12:30:17 2020 +0000 +++ b/main.cpp Mon Jan 20 12:41:12 2020 +0000 @@ -8,24 +8,21 @@ Serial wisol(D1, D0); // tx, rx + +//debug Serial pc(USBTX, USBRX); //tempAir et humAir DHT dht(D9, 22); -//RGB +//RGB + luminosite I2C i2c(PB_7, PB_6); Adafruit_TCS34725 tcs = Adafruit_TCS34725(&i2c, TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X); //tempSol DS1820 temp_sol(A4); - -//luminosite -//TSL2561_I2C lum (PB_4, PA_7); - - //humSol AnalogIn ain(A3); @@ -38,30 +35,19 @@ int data; float tempAir, humAir; + //humiditeSol + int hum_sol; + + //luminosite + float lux; + //temp_sol if(temp_sol.unassignedProbe(A4)) { pc.printf("error temperature_sol"); } - - //humiditeSol - int hum_sol; - - //luminosite - float lux; - /*if(!lum.enablePower()) - { - pc.printf("error luminosite"); - }*/ - - - - ///////////////////////////////////////// - ////////////////////RGB////////////////// - ///////////////////////////////////////// - - //char gammatable[256]; + //capteur RGB/luminosite if(!tcs.begin()) { pc.printf("No TCS34725 found ... check your connections"); @@ -86,7 +72,7 @@ /////////////// - //Capteur RGB// + //////RGB////// /////////////// uint16_t clear, red, green, blue; @@ -95,7 +81,7 @@ tcs.setInterrupt(true); // turn off LED //pc.printf("clear = %d, red = %d, green = %d, blue = %d\r\n", clear, red, green, blue); - //obtenir valeur en hexa + //get hexa value uint32_t sum = clear; float r, g, b; r = red; r /= sum; @@ -108,14 +94,13 @@ //luminosite - //lux = lum.getLux(); lux = (int)tcs.calculateLux(red,green,blue); pc.printf("lux = %d\n", (int)lux); wisol.printf("AT$SF=%06X%02X%02X%02X%04X%02X%04X%02X\r\n", (int)lux, (int)r, (int)g, (int)b, (int)(10 * temp_sol.temperature()), (int)(hum_sol), (int)(10 * tempAir), (int)(humAir)); - //wisol.printf("AT$SF=%06X%02X%02X%02X%04X%02X%04X%02X\r\n", (int)lux, (int)r, (int)g, (int)b, temp_solT, (int)(hum_sol*10), (int)(tempAir*10), (int)(humAir*10)); + //lux : 3 octets //r, g, b : 1 octet //tempSol, tempAir : 2 octets @@ -123,8 +108,8 @@ wait(10); - //Set wakeup time for 500 seconds - WakeUp::set_ms(10000); + //Set wakeup time for 600 seconds = 10min + WakeUp::set_ms(600000); deepsleep(); wait(1);