![](/media/cache/group/tvz-logo.png.50x50_q85.png)
Franjo Tudek
Dependencies: mbed SeeedShieldBot BluetoothSerial
Diff: main.cpp
- Revision:
- 0:90b835ec611a
diff -r 000000000000 -r 90b835ec611a main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri May 07 15:22:28 2021 +0000 @@ -0,0 +1,33 @@ +#include "mbed.h" +#include "Doorbell.h" + +Bell zujalica (D5); +DigitalOut ledica(D6); +InterruptIn tipkalo(D4); +int frequency[] = {261,207,196,220,196,1,246,261}; +int beat[] = {4,8,8,4,4,4,4,4 }; +int t=0, i=0; +Ticker tik1; +void tiker1() +{ + t=t+1; +} +void zvono() +{ + ledica=1; + for(i=0;i<8;i++){ + zujalica.Buzz(frequency[i], beat[i]); + } + ledica=0; +} +int main() { + tik1.attach(&tiker1, 0.01); + while(1) { + tipkalo.fall(&zvono); + if(t>=0 && t<50) + ledica=1; + if(t>=100) + t=0; + } +} +