Etienne Charbonnier
/
plant_monitoring
Plant Monitoring CS
Diff: main.cpp
- Revision:
- 61:700f3f204adc
- Parent:
- 59:169324c8e604
- Child:
- 62:4763f2aa486c
diff -r 445b8534e023 -r 700f3f204adc main.cpp --- a/main.cpp Wed Mar 25 15:55:08 2020 +0000 +++ b/main.cpp Wed Mar 25 16:06:17 2020 +0000 @@ -97,11 +97,11 @@ AnalogIn adc_vbat(ADC_VBAT); // VBAT / 3 internal to ADC channel static DevI2C devI2c(PB_11,PB_10); - static HTS221Sensor sen_hum_temp(&devI2c); - static DHT22 tempSensor(D2); + // static HTS221Sensor sen_hum_temp(&devI2c); + static DHT22 tempSensor(D2); // Vérifier que le capteur DHT22 est relié au PIN D2 static I2C i2c1(I2C_SDA, I2C_SCL); - static TSL2591 sensor1(i2c1, TSL2591_ADDR); - static AnalogIn analog_value(A0); + static TSL2591 sensor1(i2c1, TSL2591_ADDR); // Vérifier que le capteur TSL2591 est bien relié aux ports SDA et SCL + static AnalogIn analog_value(A0); // Vérifier que le capteur d'humidité du sol est bien relié au port analogique A0 //sen_hum_temp.init(NULL); //sen_hum_temp.enable(); @@ -128,10 +128,6 @@ /* Sensor acquisition */ // ADC sensors - //temp = adc_temp.read() * 100; // Converted in C - //batt = adc_vbat.read() * 30000; // Converted in mV - - // HTS221 sensors printf("Temperature and humidity acquisition\n"); tempSensor.sample(); printf("\n"); @@ -147,11 +143,9 @@ moist_r = analog_value.read(); printf("Soil moisture conversion\n"); moist_v = moist_r*100; - //sen_hum_temp.get_humidity(&h_val); - //sen_hum_temp.get_temperature(&t_val); /* Construct content of HTTP command */ - sprintf(message, "{\"temperature\": %0.2f, \"humidity\": %0.2f, \"soilmoisture\": %f, \"luminosite\": %0.2f}", temp, hum, moist_v, lux); + sprintf(message, "{\"temperature\": %0.2f, \"humidity\": %0.2f, \"soilmoisture\": %f, \"luminosite\": %0.2f}", temp, hum, moist_v, lux); // Vérifier que les API labels sont bien renseignés printf("Content Length = %d\r\n", (int)strlen(message)); /* Construct HTTP command to send */