mariozavršni
Dependencies: DHT TextLCD mbed
Fork of temperaturaivlaga by
Revision 0:296aeee1e970, committed 2016-12-22
- Comitter:
- kgrdosic
- Date:
- Thu Dec 22 13:50:20 2016 +0000
- Commit message:
- zadatak
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DHT.lib Thu Dec 22 13:50:20 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Wimpie/code/DHT/#9b5b3200688f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Thu Dec 22 13:50:20 2016 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/wim/code/TextLCD/#111ca62e8a59
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Dec 22 13:50:20 2016 +0000 @@ -0,0 +1,33 @@ +#include "mbed.h" +#include "TextLCD.h" +#include "DHT.h" + +TextLCD lcd(p19, p20, p21, p22, p23, p24, TextLCD::LCD8x2); +DHT sensor(p26, DHT11); +DigitalOut myled(p25); +AnalogIn Ain(p17); + +int err; +float c, h, alarm; +int main() +{ + while (1) { + wait(2); + err = sensor.readData(); + alarm=Ain*50.0; + if (err == 0) { + c = sensor.ReadTemperature(CELCIUS); + h = sensor.ReadHumidity(); + lcd.locate(0, 0); + lcd.printf("T %3.1f ", c); + lcd.locate(1, 1); + lcd.printf("H %3.1f ", h); + if(c>alarm) { + myled=true; + } else { + myled=false; + } + wait(0.5); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Dec 22 13:50:20 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/d75b3fe1f5cb \ No newline at end of file