Franjo Tudek

Dependencies:   mbed SeeedShieldBot BluetoothSerial

https://os.mbed.com/media/uploads/franjo1/shema.png

main.cpp

Committer:
franjo1
Date:
2021-05-07
Revision:
0:90b835ec611a

File content as of revision 0:90b835ec611a:

#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;
    }
}