![](/media/cache/group/Screenshot_1.png.50x50_q85.png)
Za lovrica
Dependencies: AM2320 INPUTS OUTS TextLCD mbed
Diff: main.cpp
- Revision:
- 0:9fdb441f3664
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Jan 21 16:00:11 2017 +0000 @@ -0,0 +1,38 @@ +#include "mbed.h" +#include "AM2320.h" +#include "OUTS.h" +#include "INPUTS.h" +//#include "TextLCD.h" + +Timer t; + +AM2320 senzor (PB_9, PB_8); +OUTS izlazi (PC_10, PC_12, PC_1, PC_0); +INPUTS ulazi (PC_2, PC_3); +Serial pc(USBTX, USBRX); +//TextLCD lcd (A0,A1,A2,A3,A4,A5); + + + +int main() { + + float trazena_temperatura, trazena_vlaga, senzor_vlaga, senzor_temperatura; + t.start(); + while (true) { + + trazena_temperatura = ulazi.get_temp_req(); + trazena_vlaga = ulazi.get_hum_req(); + senzor_vlaga = (float)senzor.humidity()/10; + senzor_temperatura = (float)senzor.temperature()/10; + izlazi.outs_on(senzor_temperatura, senzor_vlaga, trazena_temperatura, trazena_vlaga); + + if (t.read()>2){ + + pc.printf("Trazena temperatura: %.1f C\nTrazena vlaga: %.1f %%RH\n\n", trazena_temperatura, trazena_vlaga); + pc.printf("Trenutna temperatura: %.1f C\nTrenutna vlaga: %.1f %%RH\n_____________________________________________\n", senzor_temperatura, senzor_vlaga); + t.reset(); + } + + + } +} \ No newline at end of file