#include <stdio.h>
#include "pico/stdlib.h"
#define led 14
int g_timer_0 = 0;
bool status;
bool timer_0_callback(repeating_timer_t *rt);
int main() {
stdio_init_all();
gpio_init(led);
gpio_set_dir(led,GPIO_OUT);
int timer_0_hz = 1;
repeating_timer_t timer_0;
if (!add_repeating_timer_us(1000000 / timer_0_hz, timer_0_callback, NULL, &timer_0)){
printf("failed to add timer\n");
}
status = 0;
gpio_put (led,status);
while (true) {
sleep_ms(50);
}
}
bool timer_0_callback(repeating_timer_t *rt){
g_timer_0 = 0;
status = !status;
gpio_put (led, status);
return true;
}