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

#include "stm32_unict_lib.h"

int main(void)
{
	int delay_time = 1000;
	GPIO_init(GPIOB);
	GPIO_config_output(GPIOB, 0);
	GPIO_config_input(GPIOB, 10);
	for(;;) {
		GPIO_write(GPIOB,0,1);
		delay_ms(delay_time);
		GPIO_write(GPIOB,0,0);
		delay_ms(delay_time);

		int pin = GPIO_read(GPIOB, 10);
		if (pin == 0)
			delay_time = 250;
		else
			delay_time = 1000;

	}
	return 0;
}
