summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt7
-rw-r--r--hello_world.c12
2 files changed, 14 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3334714..ad5fba9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,6 +9,9 @@ pico_sdk_init()
add_executable(hello_world hello_world.c)
target_link_libraries(hello_world pico_stdlib)
-# create map/bin/hex/uf2 file in addition to ELF.
-pico_add_extra_outputs(hello_world)
+pico_enable_stdio_usb(hello_world 1)
+pico_enable_stdio_uart(hello_world 0)
+pico_enable_stdio_semihosting(hello_world 0)
+pico_enable_stdio_rtt(hello_world 0)
+pico_add_extra_outputs(hello_world) # create map/bin/hex/uf2 file in addition to ELF.
pico_set_program_url(hello_world "https://git.lukeshu.com/sbc-harness")
diff --git a/hello_world.c b/hello_world.c
index 49008a6..53e341c 100644
--- a/hello_world.c
+++ b/hello_world.c
@@ -2,7 +2,13 @@
#include "pico/stdlib.h"
int main() {
- setup_default_uart();
- printf("Hello, world!\n");
- return 0;
+ stdio_init_all();
+ gpio_init(PICO_DEFAULT_LED_PIN);
+ gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);
+
+ for (bool st = true; true; st = !st) {
+ gpio_put(PICO_DEFAULT_LED_PIN, st);
+ printf("Hello, world!\n");
+ sleep_ms(1000);
+ }
}