0

Dependencies:   Box_buzz Box_led

Files at this revision

API Documentation at this revision

Comitter:
valentino14
Date:
Thu Feb 24 18:17:08 2022 +0000
Parent:
0:2898785200f6
Commit message:
02;

Changed in this revision

Box_buzz.lib Show annotated file Show diff for this revision Revisions of this file
Box_led.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-os.lib Show annotated file Show diff for this revision Revisions of this file
--- a/Box_buzz.lib	Thu Feb 24 14:54:45 2022 +0000
+++ b/Box_buzz.lib	Thu Feb 24 18:17:08 2022 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/valentino14/code/Box_buzz/#f37201b09807
+https://os.mbed.com/users/valentino14/code/Box_buzz/#49ed31a8efea
--- a/Box_led.lib	Thu Feb 24 14:54:45 2022 +0000
+++ b/Box_led.lib	Thu Feb 24 18:17:08 2022 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/valentino14/code/Box_led/#6e09a4c848c9
+https://os.mbed.com/users/valentino14/code/Box_led/#4cd2e5fc0295
--- a/main.cpp	Thu Feb 24 14:54:45 2022 +0000
+++ b/main.cpp	Thu Feb 24 18:17:08 2022 +0000
@@ -5,8 +5,8 @@
 
 Timer debounce;                                //tajmer koji koristimo za debounce
 InterruptIn button(D7);                        //definiranje tipke za hardverski prekid
-LED led1(D3);                                  //definiranje pina za crvenu ledicu
-LED led2(D4);                                  //definiranje pina za plavu ledicu
+LED led1(D3);                                  //definiranje pina za zelena ledicu
+LED led2(D4);                                  //definiranje pina za crvena ledicu
 Beep buzzer(D5);                               //definiranje pina za zvučnik
 DigitalOut ledica(LED2);                       //definiranje ledice na Nucleo pločici
 Ticker blink;                                  //definiranje tickera
@@ -35,10 +35,8 @@
         for(a=0; a<25; a++) {                                                          //petlja za prvu melodiju 
             buzzer.beep(happy_freq[a], happy_tempo[a]);
             led1.state(1);                                                             
-            led2.state(0);
             wait(0.05);
             led1.state(0);
-            led2.state(1);
             wait(1/happy_tempo[a]);                                                    //paljenje i gašenje ledica u ritmu melodije
             if(x==2){                                                                  //pritiskom na tipkalo petlja se prekida i pokreće druga melodija
                 break;}
@@ -53,10 +51,8 @@
 { 
         for(b=0; b<20; b++) {
             buzzer.beep(scary_freq[b], scary_tempo[b]);
-            led2.state(1);
             led2.state(0);
             wait(0.05);
-            led2.state(0);
             led2.state(1);
             wait(1/scary_tempo[b]);
             if (x==3){
@@ -69,7 +65,7 @@
                                                      //Funkcija za detekciju tipke
 void pressbutton()
 {
-        if(debounce.read_ms()>100) {                 //sprečavanje signala da titra
+        if(debounce.read_ms()>100) {                 //sprečava signalu da titra
         x++;
     }
     debounce.reset();
@@ -93,7 +89,7 @@
       led1.state(0);
       led2.state(0);
       debounce.start();
-      button.rise(&pressbutton);                         //button koja poziva funkciju pressbutton na rastući brid signala tipke
+      button.rise(&pressbutton);                         // poziva funkciju pressbutton na rastući brid signala tipke
       blink.attach(&active,0.5);                         // blink ticker koji poziva funkciju active u intervalu 0.5
                                                          //while petlja
        while (true) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Thu Feb 24 18:17:08 2022 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#cf4f12a123c05fcae83fc56d76442015cb8a39e9