I am trying to set up VS Code on my mac, to run C code on my raspberry pi pico. I believe I have installed all of the relevant things from raspberry pi (I have a folder pico-sdk and a folder pico-examples). When I load up VS code, and navigate to pico-examples to try and build "blink.c" it gives me an underline in the line #include "pico/stdlib.h
. I have tried a lot of troubleshooting, but have no idea why this isn't working. ChatGPT thinks I need to have some sort of "pico/stdlib.h" file in my pico-sdk folder, but that folder does not contain any such file (it has CMakeLists.txt, docs, src, CONTRIBUTING.md, external, test, LICENSE.TXT, lib, tools, README.md, pico_sdk_init.cmake, cmake, pico_sdk_version.cmake).
Another thing I am very uncertain about is this c_cpp_properties.json file that ChatGPT has gotten me to make:
Blink code:
/**
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#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);
while (true) {
gpio_put(LED_PIN, 1);
sleep_ms(250);
gpio_put(LED_PIN, 0);
sleep_ms(250);
}
#endif
}
CMakeLists.txt:
add_executable(blink
blink.c
)
# pull in common dependencies
target_link_libraries(blink pico_stdlib)
# create map/bin/hex file etc.
pico_add_extra_outputs(blink)
# add url via pico_set_program_url
example_auto_set_url(blink)
c_cpp_properties.json (made by ChatGPT)
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"/Users/jfbeda/pico/pico-sdk"
],
"macFrameworkPath": [
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"intelliSenseMode": "clang-x64",
"compilerPath": "/usr/bin/gcc"
}
],
"version": 4
}