ejemplo de reloj despertador con FRDMKL25Z, usa un encoder y un LCD se instala parlante y tiene modo snozze (fastidio)

Dependencies:   Debounced QEI RTC-DS1307 TextLCD mbed

Fork of Tarea5_Reloj_alarma by Julian Palacio

Revision:
1:0639f31dd59f
Parent:
0:c2ed510ee88d
--- a/main.cpp	Tue May 13 18:42:02 2014 +0000
+++ b/main.cpp	Wed Sep 28 06:48:39 2016 +0000
@@ -1,9 +1,3 @@
-//Este programa se basó en el programa de tony63 teclas_PID
-
-
-//Julian Esteban Palacio Hernandez
-//Andres Mauricio Gomez Arevalo
-
 #include "mbed.h"
 #include "DebouncedIn.h"
 #include "TextLCD.h"
@@ -14,19 +8,14 @@
 Rtc_Ds1307 rtc(PTE0, PTE1);
 QEI wheel (PTA16, PTA17, NC, 48);
 
-
 DebouncedIn button_enco(PTC5);
-DebouncedIn button1(PTC12);
-DebouncedIn button2(PTC13);
-DebouncedIn button3(PTC16);
 
 PwmOut Sonido(PTA5);
 
-
 float periodo;
 float Frecuencia=4000;
 int C1=0x0C;
-int sp=0,kp=0,kd=0,ki=0,p=1,v=0,m;
+int m;
 int Conf=0;  // 0: Alarma y 1:Reloj
 int Lugar=0; // Definen el punto en el cual va el programa
 int i=0;
@@ -46,14 +35,14 @@
     periodo=(1/Frecuencia);
     Sonido.period(periodo);
     
-    rtc.getTime(tm); //lo acabé de poner
+    rtc.getTime(tm); //lee el tiempo del DS1307
 
     while(1)
     {
         switch (Lugar)
         {
             case 0:
-                m=wheel.getPulses();
+                m=wheel.getPulses();  // m son los datos del encoder
                 if(m!=0 && Conf==0){
                     Conf=1;
                     wheel.reset();  
@@ -87,7 +76,7 @@
                     wait(0.1);
                 }
                 
-                if (button_enco.falling()){
+                if (button_enco.falling()){  //si se pulsa boton encoder
                     Lugar++;
                     m=0;       
                 }
@@ -125,7 +114,7 @@
                             lcd.cls();
                             lcd.locate(0,0);
                             lcd.printf("Dia: ");
-                            //tm.date=1;
+                            
                         }    
 
                     break;
@@ -189,7 +178,7 @@
                             lcd.cls();
                             lcd.locate(0,0);
                             lcd.printf("Year: ");
-                            //tm.year=2000;
+                            
                         }
                     
                     break;
@@ -218,7 +207,7 @@
                             lcd.cls();
                             lcd.locate(0,0);
                             lcd.printf("Hora: ");
-                            //tm.hour=5;
+                            
                         }
                     
                     break;
@@ -364,7 +353,6 @@
                     lcd.printf("%02d",tm.sec); 
                        
                     lcd.locate(0,1);
-                    //lcd.printf("%s, ",rtc.weekdayToString(tm.wday));
                     lcd.printf("%02d/",tm.mon);
                     lcd.printf("%02d/",tm.date);
                     lcd.printf("%02d",tm.year);
@@ -393,7 +381,6 @@
                     
                         
                     lcd.locate(0,1);
-                    //lcd.printf("%s, ",rtc.weekdayToString(tm.wday));
                     lcd.printf("%02d/",Alarm.mon);
                     lcd.printf("%02d/",Alarm.date);
                     lcd.printf("%02d",Alarm.year);