Selecciona los juegos

Dependencies:   mbed

Revision:
2:0c22820ab1d1
Parent:
1:abc2af4246eb
Child:
3:814ec214c941
--- a/brick.cpp	Fri Nov 16 08:14:34 2018 +0000
+++ b/brick.cpp	Fri Nov 16 08:50:59 2018 +0000
@@ -15,7 +15,7 @@
 AnalogIn vrx(A4);               // Lee el eje y del jostick
 InterruptIn pulsador_abj(D8);               // Lee el boton del jostick
 DigitalIn sel(D7);
-
+PwmOut buzzer(A1);
 
 // Define numeros
 uint16_t* global_disp={0};
@@ -80,6 +80,7 @@
 // Funciones pantalla principal
 
 void pantalla_pr();
+void himno_legria();
 
 void sendSPI(uint8_t d1, uint8_t d2)
 {
@@ -139,7 +140,8 @@
           calle_funtion();
       else if (selec_p==2 && sel==1)    
           tetris();
-      
+      else if (selec_p==0 && sel==1)
+          himno_legria();
       }
       
 }
@@ -665,4 +667,23 @@
     
  void  aum_velocidad_tx(){
      velocidad=0.2;
-     }  
\ No newline at end of file
+     } 
+ 
+ void himno_legria(){
+     
+    int i;
+        buzzer=0.2;
+        for (i=0; i<13; i++) {
+            buzzer.period_us(periodos1[i]);
+            wait(0.5*duracion1[i]);
+        }
+        for (i=0; i<13; i++) {
+            buzzer.period_us(periodos2[i]);
+            wait(0.5*duracion1[i]);
+        }
+        for (i=0; i<16; i++) {
+            buzzer.period_us(periodos3[i]);
+            wait(0.5*duracion2[i]);
+        }    
+
+}     
\ No newline at end of file