pico w go blinky!

This commit is contained in:
embr 2023-04-23 19:23:28 +02:00
parent 7ace6bfa85
commit ca2b80f906
3 changed files with 29 additions and 3 deletions

View file

@ -12,7 +12,10 @@ add_executable(vibe-check
)
# Add pico_stdlib library which aggregates commonly used features
target_link_libraries(vibe-check pico_stdlib)
target_link_libraries(vibe-check
pico_stdlib
pico_cyw43_arch_none
)
# create map/bin/hex/uf2 file in addition to ELF.
pico_add_extra_outputs(vibe-check)

7
README.md Normal file
View file

@ -0,0 +1,7 @@
## Build
```
# env -C lib/pico-sdk/ git submodule update --init
# env -C build/ cmake .. -G Ninja -DPICO_BOARD=pico_w -DWIFI_SSID=YOUR_SSID_HERE -DWIFI_PASSWORD="your password here"
# env -C build/ ninja
```

View file

@ -1,8 +1,24 @@
#include <stdio.h>
#include "pico/stdlib.h"
#include "pico/cyw43_arch.h"
#ifndef CYW43_WL_GPIO_LED_PIN
#error no WiFi LED on board, wrong -DPICO_BOARD?
#endif
int main() {
setup_default_uart();
printf("Hello, world!\n");
stdio_init_all();
if (cyw43_arch_init()) {
printf("Wi-Fi init failed");
return -1;
}
while (true) {
printf("Hello, world!\n");
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1);
sleep_ms(250);
printf("Goodbye, world!\n");
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0);
sleep_ms(250);
}
return 0;
}