]>
Commit | Line | Data |
---|---|---|
1 | #include "pico/cyw43_arch.h" | |
2 | #include "pico/stdlib.h" | |
3 | ||
4 | void one_blink(int duration) { | |
5 | cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1); | |
6 | sleep_ms(duration); | |
7 | cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0); | |
8 | sleep_ms(duration); | |
9 | } | |
10 | ||
11 | void signal(int count, int duration) { | |
12 | for (int i = 0; i < count; i++) | |
13 | one_blink(duration); | |
14 | sleep_ms(1000); | |
15 | } | |
16 | ||
17 | void blink_forever(int duration) { | |
18 | while (true) { | |
19 | one_blink(duration); | |
20 | } | |
21 | } | |
22 | ||
23 | void signal_error_by_blinking() { blink_forever(100); } | |
24 | void signal_success_by_blinking() { blink_forever(400); } | |
25 | ||
26 | int main() { | |
27 | stdio_init_all(); | |
28 | if (cyw43_arch_init()) | |
29 | signal_error_by_blinking(); | |
30 | signal(1, 200); | |
31 | signal(2, 200); | |
32 | signal(3, 200); | |
33 | signal_success_by_blinking(); | |
34 | } |