EasyManua.ls Logo

Raspberry Pi Pico Series - Manually Create Your Own Project

Raspberry Pi Pico Series
54 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
NOTE
Removing power from the board does not remove the code. When you restore power to the board, the flashed code
will run again.
Aside: Other Boards
If you are not following these instructions on a Raspberry Pi Pico-series device, you may not have a BOOTSEL button (as
labelled in Figure 13). Your board may have some other way of loading code, which the board supplier should have
documented:
Most boards expose the SWD interface ([debug_probe_section]) which can reset the board and load code without
any button presses
There may be some other way of pulling down the flash CS pin (which is how the BOOTSEL button works on Pico-
series devices), such as shorting together a pair of jumper pins
Some boards have a reset button, but no BOOTSEL; they might detect a double-press of the reset button to enter the
bootloader
In all cases you should consult the documentation for the specific board you are using, which should describe the best
way to load firmware onto that board.
Manually Create your own Project
Go ahead and create a directory to house your test project sitting alongside the pico-sdk directory,
$ cd ~/pico
$ ls -la
total 16
drwxr-xr-x 7 aa staff 224 6 Apr 10:41 ./
drwx------@ 27 aa staff 864 6 Apr 10:41 ../
drwxr-xr-x 10 aa staff 320 6 Apr 09:29 pico-examples/
drwxr-xr-x 13 aa staff 416 6 Apr 09:22 pico-sdk/
$ mkdir test
$ cd test
and then create a test.c file in the directory,
Ê1 #include <stdio.h>
Ê2 #include "pico/stdlib.h"
Ê3 #include "hardware/gpio.h"
Ê4 #include "pico/binary_info.h"
Ê5
Ê6 const uint LED_PIN = 25;
Ê7
Ê8 int main() {
Ê9
10 bi_decl(bi_program_description("This is a test binary."));
11 bi_decl(bi_1pin_with_name(LED_PIN, "On-board LED"));
12
13 stdio_init_all();
14
15 gpio_init(LED_PIN);
16 gpio_set_dir(LED_PIN, GPIO_OUT);
Getting started with Raspberry Pi Pico-series
Manually Create your own Project 38

Table of Contents

Related product manuals