/*#include <stdio.h>
#include "pico/stdlib.h"
#define LED_PIN 20
int LED_STATE = 0;

volatile bool timer_fired = false;
int count =0;
  //LED_STATE = !LED_STATE;
  //gpio_put(LED_PIN, LED_STATE);
  //gpio_init(LED_PIN);
  //gpio_set_dir(LED_PIN, GPIO_OUT);
*/
#include <stdio.h>
#include "pico/stdlib.h"
#define LED_PIN 20
int LED_STATE = 0;

volatile int g_timer_0 = 0;

bool timer_0_callback(repeating_timer_t *rt) {
    g_timer_0 = 1;
    LED_STATE = !LED_STATE;
    printf("Status: %i | ", LED_STATE);
    gpio_put(LED_PIN, LED_STATE);
    return true; // keep repeating
}

int main() {
    stdio_init_all();
    gpio_init(LED_PIN);
    gpio_set_dir(LED_PIN, GPIO_OUT);
    int timer_0_hz = 2;
    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");
    }

    while(1){
        //if(g_timer_0){
        //    printf("Hello timer 0:\n");
        //    g_timer_0 = 1;
        //}
    }
}
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT