Send DHT11 & SHT10 sensors data through LoRa SX1272 board.
Dependencies: DHT11 SHTx SX1272Lib mbed
Fork of SX1272-Transmitter by
Revision 23:711e46d8c9c6, committed 2017-04-03
- Comitter:
- Antoine38
- Date:
- Mon Apr 03 15:10:40 2017 +0000
- Parent:
- 22:e6a5e6cf38cb
- Commit message:
- Fix some variables
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r e6a5e6cf38cb -r 711e46d8c9c6 main.cpp --- a/main.cpp Mon Apr 03 10:55:48 2017 +0000 +++ b/main.cpp Mon Apr 03 15:10:40 2017 +0000 @@ -112,9 +112,8 @@ msg[0] = 0x00; // Temperature - Air msg[1] = 0x00; // Humidity - Air } - soilSensor.setScale(false); + msg[2] = to_u8(soilSensor.getTemperature(), true); // Temperature - Soil - soilSensor.setScale(true); msg[3] = to_u8(soilSensor.getHumidity(), false); // Humidity - Soil // Measurements types - Should be 0111 0010 -> 0x72 msg[4] = 0x72; @@ -144,7 +143,7 @@ // humidity: 0 < x < 100 uint8_t to_u8(float x, bool isTemp) { - float a = 30; + float a = 0; float min = 0.0; float max = 100.0; if( isTemp) { @@ -155,7 +154,7 @@ // On passe le float entre 0 et 1.0 if(x > min && x < max) { x = (x + a) / 100.0; - } else if(x <= -30) { + } else if(x <= min) { x = 0.0; } else { x = 1.0;