mario
Dependencies: DHT TextLCD mbed
Fork of programski_zadatak_senzor 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
diff -r 000000000000 -r 296aeee1e970 DHT.lib --- /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
diff -r 000000000000 -r 296aeee1e970 TextLCD.lib --- /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
diff -r 000000000000 -r 296aeee1e970 main.cpp --- /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
diff -r 000000000000 -r 296aeee1e970 mbed.bld --- /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