Andrea Corrado
/
mbed-cloud-connect-sensor-temp-hum
Sets up LCD and prints sensor data value of SHT31-D temperature/humidity sensor to LCD
Revision 0:624458d6086e, committed 2017-11-01
- Comitter:
- andcor02
- Date:
- Wed Nov 01 13:13:38 2017 +0000
- Child:
- 1:0ec5fde072a1
- Commit message:
- Initial commit
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832.lib Wed Nov 01 13:13:38 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/chris/code/C12832/#7de323fa46fe
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sht31.lib Wed Nov 01 13:13:38 2017 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/andcor02/code/Sht31/#c84a60326ecf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Nov 01 13:13:38 2017 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" +#include "C12832.h" +#include "Sht31.h" + +/* Sets up LCD and prints sensor data value of temperature sensor to LCD */ + +C12832 lcd(PE_14, PE_12, PD_12, PD_11, PE_9); //LCD: MOSI, SCK, RESET, A0, nCS +Sht31 sht31(PF_0, PF_1); //TEMP SENSOR: I2C_SDA, I2C_SCL + +int main() +{ + while(1) { + float t = sht31.readTemperature(); + float h = sht31.readHumidity(); + + lcd.locate(0,3); + lcd.printf("[TEMP/HUM]"); + lcd.locate(0,15); + lcd.printf("TEMP:%3.2fC, HUM:%3.2f%%", t, h); // Print to LCD values + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Wed Nov 01 13:13:38 2017 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#98ba8acb83cfc65f30a8a0771a27c71443ab093a