Sigfox project

Dependencies:   mbed TCS34725 WakeUp DHT TSL2561_I2C DS1820

Committer:
ran_ghe
Date:
Tue Oct 15 08:56:41 2019 +0000
Revision:
1:07835f780c89
Parent:
0:cfed96a14467
Child:
2:e153d5219f93
rajout capteur temp_sol

Who changed what in which revision?

UserRevisionLine numberNew contents of line
youdllo5 0:cfed96a14467 1 #include "mbed.h"
ran_ghe 1:07835f780c89 2 #include "DS1820.h"
youdllo5 0:cfed96a14467 3 #include "DHT.h"
youdllo5 0:cfed96a14467 4 #include "TCS3472_I2C.h"
youdllo5 0:cfed96a14467 5
youdllo5 0:cfed96a14467 6 //DigitalOut led(LED3);
youdllo5 0:cfed96a14467 7 Serial pc(USBTX, USBRX);
youdllo5 0:cfed96a14467 8 DHT dht(A1, 22);
youdllo5 0:cfed96a14467 9 TCS3472_I2C rgb_sensor( PB_4, PA_7 );
ran_ghe 1:07835f780c89 10 DS1820 temp_sol(A2);
youdllo5 0:cfed96a14467 11
youdllo5 0:cfed96a14467 12 int main(){
youdllo5 0:cfed96a14467 13
youdllo5 0:cfed96a14467 14 int data;
youdllo5 0:cfed96a14467 15 rgb_sensor.enablePowerAndRGBC();
youdllo5 0:cfed96a14467 16 rgb_sensor.setIntegrationTime(100);
youdllo5 0:cfed96a14467 17 int rgb_readings[4];
youdllo5 0:cfed96a14467 18
youdllo5 0:cfed96a14467 19
ran_ghe 1:07835f780c89 20 //erreur temp_sol
ran_ghe 1:07835f780c89 21 if(temp_sol.unassignedProbe(A2))
ran_ghe 1:07835f780c89 22 {
ran_ghe 1:07835f780c89 23 pc.printf("error temperature_sol");
ran_ghe 1:07835f780c89 24 }
ran_ghe 1:07835f780c89 25
youdllo5 0:cfed96a14467 26 while(1){
ran_ghe 1:07835f780c89 27 //Capteur air
ran_ghe 1:07835f780c89 28 //data = dht.readData();
youdllo5 0:cfed96a14467 29
ran_ghe 1:07835f780c89 30
ran_ghe 1:07835f780c89 31 //Capteur RGB
ran_ghe 1:07835f780c89 32
ran_ghe 1:07835f780c89 33 /*rgb_sensor.getAllColors(rgb_readings);
youdllo5 0:cfed96a14467 34 //led = !led;
youdllo5 0:cfed96a14467 35 if(data == ERROR_NONE){
youdllo5 0:cfed96a14467 36 pc.printf("La temperature de la salle est: %.2f et Humidite est: %.2f\n", dht.ReadTemperature(CELCIUS), dht.ReadHumidity());
youdllo5 0:cfed96a14467 37 }
youdllo5 0:cfed96a14467 38 else{
youdllo5 0:cfed96a14467 39 //pc.printf("Erreur numero: %d\n", data);
ran_ghe 1:07835f780c89 40 }
ran_ghe 1:07835f780c89 41 pc.printf( "red: %d, green: %d, blue: %d, clear: %d\n", rgb_readings[0], rgb_readings[1], rgb_readings[2], rgb_readings[3] );
ran_ghe 1:07835f780c89 42 wait_ms(5000);*/
ran_ghe 1:07835f780c89 43
youdllo5 0:cfed96a14467 44
ran_ghe 1:07835f780c89 45 //Capteur temperature sol
ran_ghe 1:07835f780c89 46 temp_sol.convertTemperature(true, DS1820::all_devices);
ran_ghe 1:07835f780c89 47 pc.printf("temperature : %.1f\n", temp_sol.temperature());
ran_ghe 1:07835f780c89 48 wait(3);
youdllo5 0:cfed96a14467 49
youdllo5 0:cfed96a14467 50 }
youdllo5 0:cfed96a14467 51 }