Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
spremnikVode.h
00001 #include "mbed.h" 00002 00003 DigitalIn sensor(D9); 00004 InterruptIn sw(D8); 00005 DigitalIn button(D2); 00006 DigitalOut yLed(A5); 00007 DigitalOut led(A0); 00008 DigitalOut gLed(A1); 00009 DigitalOut buzzer(A2); 00010 bool gLedLight; 00011 Ticker ticker; 00012 bool full; 00013 bool on; 00014 00015 void flash(DigitalOut lamp, int period) { 00016 lamp = !lamp; 00017 wait_ms(period); 00018 printf ("Water level is low! "); 00019 } 00020 00021 bool startFilling () { 00022 printf("Water is filling. "); 00023 yLed = true; 00024 wait_ms(5000); 00025 printf("Water level is now ok. "); 00026 return true; 00027 } 00028 00029 void flashGreen() { 00030 gLedLight = !gLedLight; 00031 } 00032 00033 void buzz(){ 00034 buzzer = true; 00035 wait_ms(2000); 00036 buzzer = false; 00037 } 00038 00039 void buttonPressed () { 00040 if (full) { 00041 ticker.attach(&buzz, 2.0); 00042 } 00043 } 00044 00045 void turnOn () { 00046 on = !on; 00047 00048 }
Generated on Fri Sep 9 2022 00:19:13 by
1.7.2