das
Revision 0:ffef1cca62a8, committed 2017-01-21
- Comitter:
- Paaranoja
- Date:
- Sat Jan 21 15:59:12 2017 +0000
- Commit message:
- SD
Changed in this revision
OUTS.cpp | Show annotated file Show diff for this revision Revisions of this file |
OUTS.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OUTS.cpp Sat Jan 21 15:59:12 2017 +0000 @@ -0,0 +1,35 @@ +#include "mbed.h" +#include "OUTS.h" + + + +OUTS::OUTS(PinName grijac_pin, PinName atomizer_pin, PinName grijac_led_pin, PinName atomizer_led_pin):grijac(grijac_pin), atomizer(atomizer_pin), led_grijac(grijac_led_pin), led_atomizer(atomizer_led_pin){ + grijac = 0; + atomizer = 0; + led_atomizer = 0; + led_grijac = 0; + } + +void OUTS::outs_on(float senzor_temp, float senzor_hum, float pot_temp, float pot_hum){ + chk_temp(senzor_temp, pot_temp); + chk_hum(senzor_hum, pot_hum); + } + +void OUTS::chk_temp(float senzor_temp, float pot_temp){ + if (pot_temp>senzor_temp){ + grijac = 1; + led_grijac = 1; + }else { + grijac = 0; + led_grijac = 0; + } + } +void OUTS::chk_hum(float senzor_hum, float pot_hum){ + if (pot_hum>senzor_hum){ + atomizer = 1; + led_atomizer = 1; + } else { + atomizer = 0; + led_atomizer = 0; + } + } \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OUTS.h Sat Jan 21 15:59:12 2017 +0000 @@ -0,0 +1,19 @@ +#ifndef OUTS_H +#define OUTS_H +#include "mbed.h" + +class OUTS { + public: + OUTS(PinName grijac_pin, PinName atomizer_pin, PinName grijac_led_pin, PinName atomizer_led_pin); + void outs_on(float senzor_temp, float senzor_hum, float pot_temp, float pot_hum); + + private: + void chk_hum(float senzor_hum, float pot_hum); + void chk_temp(float senzor_temp, float pot_temp); + float senzor_temp, senzor_hum, pot_temp, pot_hum; + DigitalOut atomizer; + DigitalOut grijac; + DigitalOut led_grijac; + DigitalOut led_atomizer; + }; +#endif \ No newline at end of file