int main(void)
{
   /* perform the needed initialization here */
	int i=1;

	inicializacion_de_led();
	inicializar_timer(250);
	configurar_tecla();
	NVIC_EnableIRQ(11); //habilito interrupcion

	while (1){

		if (bandera1){

		    	if(!(leer_tecla()&0b1000)){
		    			led=3;
		    	}


		    	if(!(leer_tecla()&0b0100)){
		    		led=2;
		    	}


		    	if(!(leer_tecla()&0b0010)){
		    		    		    	led=1;
		    		}


		    	if(!(leer_tecla()&0b0001)){
		    		led=LED_ROJO;
		    	}

		    	cambiar_estado(led);

		    	for (i=1;i<5;i++){
		    		if (led!=i){
		    			apagar_led(i);
		    		}
		    	}



		    	bandera1=0;
		    		}
		    }

		         return 0;


}
예제 #2
0
int main(void) {
    SystemInit();
    inicializar_gpio();
    inicializar_timer();
    while (1) {
        for(pulse = 70; pulse <= 200; pulse++) {
            TIM4->CCR1 = pulse;
            delay(800000);
        }
        for(pulse = 200; pulse >= 70; pulse--) {
            TIM4->CCR1 = pulse;
            delay(800000);
        }
    }
}
int main(void)
{
   /* perform the needed initialization here */

	inicializacion_de_led();
	encender_led (1);
	inicializar_timer(250);
	NVIC_EnableIRQ(11); //habilito interrupcion


while (1){


	if (bandera1){

		if (c==1){
			encender_led(1);
			apagar_led(6);
		}else {
			cambiar_estado(c);
			cambiar_estado(c-1);
		}

		if (c<6){
			c=c+1;
		}else {
			c=1;
		}

		bandera1=0;
	}



}

         return 0;


}