delay 10s
Dependencies: HX711 DHT DS1820
Diff: main.cpp
- Revision:
- 7:4894e844911e
- Parent:
- 6:5edb45f97ffe
- Child:
- 8:b4756746d196
diff -r 5edb45f97ffe -r 4894e844911e main.cpp --- a/main.cpp Sun Nov 22 18:08:27 2020 +0000 +++ b/main.cpp Sun Nov 22 18:18:30 2020 +0000 @@ -36,6 +36,13 @@ pc.printf("DS1820 sensor found!\r\n"); } + if (!ds1820_2.begin()){ + pc.printf("No DS1820 sensor found!\r\n"); + } + else{ + pc.printf("DS1820 sensor found!\r\n"); + } + float valeurTare = loadcell.getValue(); while(1) { @@ -48,7 +55,7 @@ ThisThread::sleep_for(1000);// let DS1820 complete the temperature conversion result = ds1820_1.read(temp1); // read temperature from DS1820 and perform cyclic redundancy check (CRC) - result = ds1820_2.read(temp1); + result = ds1820_2.read(temp2); error1 = sensor1.readData(); //read error value error2 = sensor2.readData(); //read error value @@ -65,10 +72,12 @@ pc.printf("Humidite_int = %4.2f\r\n", h_int); pc.printf("temperature_ext = %4.2f\r\n", c_ext); // on affiche les valeurs sur teraTerm pour debug pc.printf("Humidite_ext = %4.2f\r\n", h_ext); + pc.printf("ds1 = %4.2f\r\n", temp1); // on affiche les valeurs sur teraTerm pour debug + pc.printf("ds2 = %4.2f\r\n", temp2); device.printf("AT$SF=%02X%02X%02X%02X%02X\r\n", (char) c_moyenne_int,(char) h_int, (char) c_ext, (char) h_ext,(char) balance); // on envoie les données sur l'antenne - wait(20.0f); + wait(10.0f); } }