#include <stdio.h>
#include "pico/stdlib.h"
#define LED_PIN 15 // GPIO 15 corresponds to physical pin 20
void blink_led(int times) {
for (int i = 0; i < times; i++) {
gpio_put(LED_PIN, 1); // Turn on the LED
sleep_ms(500); // Delay for 500 milliseconds (2 seconds)
gpio_put(LED_PIN, 0); // Turn off the LED
sleep_ms(500); // Delay for 500 milliseconds (2 seconds)
}
}
int main() {
gpio_init(LED_PIN); // Initialize the GPIO pin for the LED
gpio_set_dir(LED_PIN, GPIO_OUT); // Set the LED pin as output
int blink_times = 0;
unsigned long start_time = time_us_64();
while (1) {
unsigned long current_time = time_us_64();
unsigned long elapsed_time = current_time - start_time;
unsigned long elapsed_minutes = elapsed_time / 60000000;
if (elapsed_minutes == 0 && blink_times < 10) {
blink_led(1); // Blink the LED once
blink_times++;
} else if (elapsed_minutes == 1 && blink_times < 30) {
blink_led(1); // Blink the LED once
blink_times++;
} else if (elapsed_minutes == 2 && blink_times < 60) {
blink_led(1); // Blink the LED once
blink_times++;
}
// Reset the start time and blink count at the beginning of each minute
if (elapsed_minutes > 2) {
start_time = current_time;
blink_times = 0;
}
}
return 0;
}