pepe

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Config.cpp Source File

Config.cpp

00001 #include "alarma.h"
00002 #include "mbed.h"
00003 
00004 int contador = 0;
00005 
00006 void Config(void){
00007     if(Prog == 1){                              //Bandera para que entre a programacion solo después de un reseteo.
00008         while(Pulsador != false);               //Espero que se suelte el pulsador.                                   
00009         Pip(3);
00010         while(true){
00011             if(contador >= 25){                 //Si el tiempo llega a 5 seg...
00012                 Pip(3);
00013                 contador = 0;
00014                 break;
00015             }
00016             contador = 0;
00017             while(Pulsador != true)            //Aguardo a que se presione el pulsador.
00018                 KeepAlive();
00019             wait(0.05);
00020             delaySirena++;
00021             Pip(1);
00022             if(delaySirena >= 10)
00023                 delaySirena = 1;
00024             while(Pulsador != false){           //Espero que se suelte el pulsador. 
00025                 contador++;
00026                 KeepAlive();                    //0.2 segundos
00027             }               
00028         }
00029         while(true){
00030             if(contador >= 25){
00031                 Pip(3);
00032                 contador = 0;
00033                 break;
00034             }
00035             contador = 0;
00036             while(Pulsador != true)
00037                 KeepAlive();
00038             wait(0.05);
00039             delayLuz++;
00040             Pip(1);
00041             if(delayLuz >= 10)
00042                 delayLuz = 1;
00043             while(Pulsador != false){
00044                 contador++;
00045                 KeepAlive();                    //0.2 segundos
00046             }               
00047         }
00048         while(true){
00049             if(contador >= 25){
00050                 Buzzer = 1;
00051                 wait(1);
00052                 Buzzer = 0;
00053                 wait(1);
00054                 contador = 0;          
00055                 return;
00056             }
00057             contador = 0;
00058             while(Pulsador != true)
00059                 KeepAlive();
00060             wait(0.05);
00061             delayFactory = delayFactory + 1;
00062             Pip(1);
00063             if(delayFactory >= 5)
00064                 delayFactory = 2;
00065             while(Pulsador != false){
00066                 contador++;
00067                 KeepAlive();                    //0.2 segundos
00068             }               
00069         }
00070     }
00071 }
00072