Fix examples to build cleanly if PICO_DEFAULT_LED_PIN isn't defined

This commit is contained in:
Andrew Scheller
2021-03-04 11:32:56 +00:00
committed by Graham Sanderson
parent 482d9657d3
commit 4d7882bc59
5 changed files with 26 additions and 9 deletions

View File

@@ -7,6 +7,9 @@
#include "pico/stdlib.h"
int main() {
#ifndef PICO_DEFAULT_LED_PIN
#warning blink example requires a board with a regular LED
#else
const uint LED_PIN = PICO_DEFAULT_LED_PIN;
gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, GPIO_OUT);
@@ -16,4 +19,5 @@ int main() {
gpio_put(LED_PIN, 0);
sleep_ms(250);
}
#endif
}