Franjo Tudek

Dependencies:   mbed SeeedShieldBot BluetoothSerial

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

Files at this revision

API Documentation at this revision

Comitter:
franjo1
Date:
Fri May 07 15:22:28 2021 +0000
Commit message:
Franjo Tudek

Changed in this revision

BluetoothSerial.lib Show annotated file Show diff for this revision Revisions of this file
Doorbell.cpp Show annotated file Show diff for this revision Revisions of this file
Doorbell.h Show annotated file Show diff for this revision Revisions of this file
SeeedShieldBot.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 90b835ec611a BluetoothSerial.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BluetoothSerial.lib	Fri May 07 15:22:28 2021 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/yihui/code/BluetoothSerial/#f56002898ee8
diff -r 000000000000 -r 90b835ec611a Doorbell.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Doorbell.cpp	Fri May 07 15:22:28 2021 +0000
@@ -0,0 +1,12 @@
+#include "Doorbell.h"
+#include "mbed.h"
+Bell::Bell(PinName Piezzo) : Buzzer(Piezzo) {
+    
+}
+
+void Bell::Buzz(int f, int b) {
+    
+    Buzzer.period(1/(f)); // set PWM period
+    Buzzer=0.5; // set duty cycle
+    wait(0.5*b);
+}
diff -r 000000000000 -r 90b835ec611a Doorbell.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Doorbell.h	Fri May 07 15:22:28 2021 +0000
@@ -0,0 +1,12 @@
+#ifndef DoorBell_h
+#define DoorBell_h
+#include "mbed.h"
+class Bell{
+public:
+    Bell(PinName Buzzer);
+    void Buzz(int f, int b);
+    
+private:
+    PwmOut Buzzer; 
+};
+#endif
diff -r 000000000000 -r 90b835ec611a SeeedShieldBot.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SeeedShieldBot.lib	Fri May 07 15:22:28 2021 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/components/code/SeeedShieldBot/#9fd1722259a1
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;
+    }
+}
+
diff -r 000000000000 -r 90b835ec611a mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri May 07 15:22:28 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file