/**
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#define LED_PIN PICO_DEFAULT_LED_PIN
static int res,count;
static int value=0;
int three=0;
int store[3]={ 6,3,2 };
#include <stdio.h>
#include "pico/stdlib.h"
int blink()
{
if( count == store[three])
{
value=!value;
gpio_put(LED_PIN,value);
printf("Blink every %d sec\n",count);
count=0;
}
}
bool repeating_timer_callback(struct repeating_timer *t)
{
res++; // count every sec
count++;
printf("Time in sec =%d\n",res);
blink();
}
int main() {
gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, GPIO_OUT);
struct repeating_timer timer;
add_repeating_timer_ms(1000, repeating_timer_callback, NULL, &timer);
while (true) {
tight_loop_contents();
}
}