Punjenje i pražnjenje spremnika vode
Dependencies: mbed
spremnikVode.h
- Committer:
- mrimac
- Date:
- 21 months ago
- Revision:
- 1:07c01a8966ae
- Parent:
- 0:1a5027292b9a
File content as of revision 1:07c01a8966ae:
#include "mbed.h" DigitalIn sensor(D9); InterruptIn sw(D8); DigitalIn button(D2); DigitalOut yLed(A5); DigitalOut led(A0); DigitalOut gLed(A1); DigitalOut buzzer(A2); bool gLedLight; Ticker ticker; bool full; bool on; void flash(DigitalOut lamp, int period) { lamp = !lamp; wait_ms(period); printf ("Water level is low! "); } bool startFilling () { printf("Water is filling. "); yLed = true; wait_ms(5000); printf("Water level is now ok. "); return true; } void flashGreen() { gLedLight = !gLedLight; } void buzz(){ buzzer = true; wait_ms(2000); buzzer = false; } void buttonPressed () { if (full) { ticker.attach(&buzz, 2.0); } } void turnOn () { on = !on; }