forked from raspberrypi/pico-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhello_double_tap.c
More file actions
31 lines (28 loc) · 823 Bytes
/
hello_double_tap.c
File metadata and controls
31 lines (28 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "pico/stdlib.h"
// This is a regular old LED blinking example, however it is linked with the
// `pico_bootsel_via_double_reset` library, so resetting the board twice
// quickly will enter the USB bootloader. This is useful for boards which have
// a reset button but no BOOTSEL, as long as you remember to always link the
// `pico_bootsel_via_double_reset` library!
int main() {
#ifdef PICO_DEFAULT_LED_PIN
const uint LED_PIN = PICO_DEFAULT_LED_PIN;
gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, GPIO_OUT);
while (true) {
gpio_put(LED_PIN, 1);
sleep_ms(250);
gpio_put(LED_PIN, 0);
sleep_ms(250);
}
#else
while (true) {
sleep_ms(250);
}
#endif
}