Punjenje i pražnjenje spremnika vode
Dependencies: mbed
Diff: spremnikVode.h
- Revision:
- 1:07c01a8966ae
- Parent:
- 0:1a5027292b9a
--- a/spremnikVode.h Thu Sep 08 11:15:30 2022 +0000 +++ b/spremnikVode.h Fri Sep 09 00:14:08 2022 +0000 @@ -1,15 +1,16 @@ #include "mbed.h" DigitalIn sensor(D9); -DigitalIn sw(D8); -InterruptIn button(D2); -DigitalOut buzzer(A5); +InterruptIn sw(D8); +DigitalIn button(D2); +DigitalOut yLed(A5); DigitalOut led(A0); DigitalOut gLed(A1); +DigitalOut buzzer(A2); +bool gLedLight; Ticker ticker; -bool debug2; bool full; -bool debug; +bool on; void flash(DigitalOut lamp, int period) { lamp = !lamp; @@ -19,18 +20,29 @@ bool startFilling () { printf("Water is filling. "); - buzzer = true; + yLed = true; wait_ms(5000); printf("Water level is now ok. "); return true; } -void tick () { - lowLevel = sensor; +void flashGreen() { + gLedLight = !gLedLight; + } + +void buzz(){ + buzzer = true; + wait_ms(2000); + buzzer = false; + } + +void buttonPressed () { + if (full) { + ticker.attach(&buzz, 2.0); + } } -void interrupt () { - if (debug) { - debug2 = !debug2; - } -} \ No newline at end of file +void turnOn () { + on = !on; + + } \ No newline at end of file