.
Dependencies: DHT TextLCD mbed
main.cpp
- Committer:
- masavucic
- Date:
- 2017-03-10
- Revision:
- 0:9f541bb6b622
File content as of revision 0:9f541bb6b622:
#include "mbed.h" #include "TextLCD.h" #include "DHT.h" TextLCD lcd(p19, p20, p21, p22, p23, p24); // rs, e, d4-d7 DigitalOut alarmLedLeft(p25); DigitalOut alarmLedRight(p26); DHT sensorLeft(p27, DHT11); DHT sensorRight(p28, DHT11); int main() { lcd.printf("Hello World!\n"); lcd.printf("Hello World!\n"); lcd.printf(" temp i vlaga"); float tempLeft =0.0; float tempRight =0.0; float leftHumidity =0.0; float rightHumidity =0.0; while (1) { wait(2); lcd.cls(); int err0 = sensorLeft.readData(); tempLeft = sensorLeft.ReadTemperature(CELCIUS); leftHumidity = sensorLeft.ReadHumidity(); lcd.cls(); lcd.locate(0, 0); lcd.printf("Temp Left %3.1f\n", tempLeft); lcd.locate(0, 1); lcd.printf("Humidity %3.1f \n", leftHumidity); wait(2); int err1 = sensorRight.readData(); tempRight = sensorRight.ReadTemperature(CELCIUS); rightHumidity = sensorRight.ReadHumidity(); lcd.cls(); lcd.locate(0, 0); lcd.printf("Temp right %3.1f\n", tempRight); lcd.locate(0, 1); lcd.printf("Humidity %3.1f \n", rightHumidity); if(tempLeft>35) alarmLedLeft=true; if(tempRight>35) alarmLedRight =true; } }