On my Raspberry Pi Pico W I can run the example blink project just fine. But when I create my own project (even using the same code as the blink project) I cannot get it to work (I know onboard LED is different to that of the standard Raspberry Pi Pico).
I either get everything to compile and when I copy the uf2 file it copies, disconnects and then nothing (no blinking), or I cannot compile after taking snippets from others' CMakeLists.txt files and adding includes in my .c file. Error:
pico-sdk/lib/lwip/src/include/lwip/opt.h:51:10: fatal error: lwipopts.h: No such file or directory
----51 | #include "lwipopts.h"
CMakeLists.txt:
cmake_minimum_required(VERSION 3.13)
include(pico_sdk_import.cmake)
project(blink C CXX ASM)
set(CMAKE_C STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
pico_sdk_init()
add_executable(blink
main.c
)
target_include_directories(blink PRIVATE ${CMAKE_CURRENT_LIST_DIR} )
target_link_libraries(blink pico_cyw43_arch pico_stdlib)
pico_add_extra_outputs(blink)
.c file:
#include "pico/stdlib.h"
#include "pico/cyw43_arch.h"
int main() {
stdio_init_all();
while (true) {
printf("LED on\n");
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1);
sleep_ms(2500);
printf("LED off\n");
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0);
sleep_ms(2500);
}
return 0;
}