![](/media/cache/group/Screenshot_1.png.50x50_q85.png)
Za lovrica
Dependencies: AM2320 INPUTS OUTS TextLCD mbed
main.cpp@0:9fdb441f3664, 2017-01-21 (annotated)
- Committer:
- Paaranoja
- Date:
- Sat Jan 21 16:00:11 2017 +0000
- Revision:
- 0:9fdb441f3664
seminarski
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Paaranoja | 0:9fdb441f3664 | 1 | #include "mbed.h" |
Paaranoja | 0:9fdb441f3664 | 2 | #include "AM2320.h" |
Paaranoja | 0:9fdb441f3664 | 3 | #include "OUTS.h" |
Paaranoja | 0:9fdb441f3664 | 4 | #include "INPUTS.h" |
Paaranoja | 0:9fdb441f3664 | 5 | //#include "TextLCD.h" |
Paaranoja | 0:9fdb441f3664 | 6 | |
Paaranoja | 0:9fdb441f3664 | 7 | Timer t; |
Paaranoja | 0:9fdb441f3664 | 8 | |
Paaranoja | 0:9fdb441f3664 | 9 | AM2320 senzor (PB_9, PB_8); |
Paaranoja | 0:9fdb441f3664 | 10 | OUTS izlazi (PC_10, PC_12, PC_1, PC_0); |
Paaranoja | 0:9fdb441f3664 | 11 | INPUTS ulazi (PC_2, PC_3); |
Paaranoja | 0:9fdb441f3664 | 12 | Serial pc(USBTX, USBRX); |
Paaranoja | 0:9fdb441f3664 | 13 | //TextLCD lcd (A0,A1,A2,A3,A4,A5); |
Paaranoja | 0:9fdb441f3664 | 14 | |
Paaranoja | 0:9fdb441f3664 | 15 | |
Paaranoja | 0:9fdb441f3664 | 16 | |
Paaranoja | 0:9fdb441f3664 | 17 | int main() { |
Paaranoja | 0:9fdb441f3664 | 18 | |
Paaranoja | 0:9fdb441f3664 | 19 | float trazena_temperatura, trazena_vlaga, senzor_vlaga, senzor_temperatura; |
Paaranoja | 0:9fdb441f3664 | 20 | t.start(); |
Paaranoja | 0:9fdb441f3664 | 21 | while (true) { |
Paaranoja | 0:9fdb441f3664 | 22 | |
Paaranoja | 0:9fdb441f3664 | 23 | trazena_temperatura = ulazi.get_temp_req(); |
Paaranoja | 0:9fdb441f3664 | 24 | trazena_vlaga = ulazi.get_hum_req(); |
Paaranoja | 0:9fdb441f3664 | 25 | senzor_vlaga = (float)senzor.humidity()/10; |
Paaranoja | 0:9fdb441f3664 | 26 | senzor_temperatura = (float)senzor.temperature()/10; |
Paaranoja | 0:9fdb441f3664 | 27 | izlazi.outs_on(senzor_temperatura, senzor_vlaga, trazena_temperatura, trazena_vlaga); |
Paaranoja | 0:9fdb441f3664 | 28 | |
Paaranoja | 0:9fdb441f3664 | 29 | if (t.read()>2){ |
Paaranoja | 0:9fdb441f3664 | 30 | |
Paaranoja | 0:9fdb441f3664 | 31 | pc.printf("Trazena temperatura: %.1f C\nTrazena vlaga: %.1f %%RH\n\n", trazena_temperatura, trazena_vlaga); |
Paaranoja | 0:9fdb441f3664 | 32 | pc.printf("Trenutna temperatura: %.1f C\nTrenutna vlaga: %.1f %%RH\n_____________________________________________\n", senzor_temperatura, senzor_vlaga); |
Paaranoja | 0:9fdb441f3664 | 33 | t.reset(); |
Paaranoja | 0:9fdb441f3664 | 34 | } |
Paaranoja | 0:9fdb441f3664 | 35 | |
Paaranoja | 0:9fdb441f3664 | 36 | |
Paaranoja | 0:9fdb441f3664 | 37 | } |
Paaranoja | 0:9fdb441f3664 | 38 | } |