Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3552

General • Re: PICO W Getting Started - I2C scanner Build Errors

$
0
0
arg001
Thank you for the observation.
Looking at the example code I see:
CMakeLists.txt

Code:

add_executable(i2c_bus_scan        bus_scan.c        )# pull in common dependencies and additional i2c hardware supporttarget_link_libraries(i2c_bus_scan pico_stdlib [b]hardware_i2c[/b])# create map/bin/hex file etc.pico_add_extra_outputs(i2c_bus_scan)# add url via pico_set_program_urlexample_auto_set_url(i2c_bus_scan)
and the declarations in the code:
bus_scan.c

Code:

#include <stdio.h>#include "pico/stdlib.h"#include "pico/binary_info.h"[b]#include "hardware/i2c.h"[/b]
If I use the declarations above in VSCODE the hardware/i2c.h is flagged as not found.

Are you saying the example is wrong? It certainly brings generates an error on the #include "hardware/i2c.h" line.

I will try removing that line and see what happens.

As some one new to this processor how am I supposed to know that the example is wrong and in what manner it is wrong?
Can you point me to any explanation of this 'artifact' you describe so that I can make some progress.

Cheers
Ted

Statistics: Posted by tfcroft4 — Thu Feb 01, 2024 9:57 am



Viewing all articles
Browse latest Browse all 3552

Trending Articles