/*
 * led_flash_2.c
 *
 *  Created on: Oct 3, 2018
 *      Author: corrado
 */

#include "stm32_unict_lib.h"

int main(void)
{
	int delay_time_0 = 20;
	int delay_time_1 = 1;
	GPIO_init(GPIOB);
	GPIO_config_output(GPIOB, 0);
	GPIO_config_input(GPIOB, 10);
	for(;;) {
		if (GPIO_read(GPIOB, 10) == 0) {
			GPIO_write(GPIOB,0,1);
		}
		else {
			GPIO_write(GPIOB,0,1);
			delay_ms(delay_time_1);

			GPIO_write(GPIOB,0,0);
			delay_ms(delay_time_0);
		}
	}
	return 0;
}
