Articles Hierarchy

Articles Home » RPI » Raspberry Pi PICO

Raspberry Pi PICO

here now 'my two worlds' come closer together..
Raspberry Pi has a little brother, a arduino like development board
the PICO


https://www.raspberrypi.org/documentation/pico/getting-started/
also see
https://hackaday.com/2021/01/20/raspberry-pi-enters-microcontroller-game-with-4-pico/
and more
https://www.raspberrypi.org/blog/raspberry-pi-pico-what-did-you-think/
the data sheet for the board
https://datasheets.raspberrypi.org/pico/pico_datasheet.pdf
or getting started with C++ ( instead Python )
https://datasheets.raspberrypi.org/pico/getting_started_with_pico.pdf
you might try
https://raw.githubusercontent.com/raspberrypi/pico-setup/master/pico_setup.sh or
https://github.com/raspberrypi/pico-setup/blob/master/pico_setup.sh

touch pico_setup.sh
nano pico_setup.sh
copy paste raw code into
chmod +x pico_setup.sh
./pico_setup.sh





ok, today 22.02.2021 i see that one shop has now boards available and i ordered / only one to see how that works out about payment on delivery / here
for 209 THB ( incl. transport, no pins ) about 5.7 Euro, and delivery took 6 days.

well, already had following question in my mind:
if i install microPython on it, how to UNDO?



ok, lets get a USB cable from a old phone
++ connect board to cable,
++ cable to USB of RPI4 ++ while press board "bootsel" button until see

now drag drop (copy) downloaded "blink.uf2" file ( using the file-manager in 2 window mode )
the USB connection drops & board reboots & executes blink.uf2 & LED blinks.

for verify that it also blinks again after cable ( power ) reconnected,
ok, that means it is "installed" as "main"
when you connect with bootsel button pressed you see same 2 files from first connection
INFO_UF2.TXT:
UF2 Bootloader v1.0
Model: Raspberry Pi RP2
Board-ID: RPI-RP2

INDEX.HTM:
Redirecting to https://www.raspberrypi.org/documentation/rp2040/getting-started/


now follow the getting started, "hallo world.uf2"
and use terminal minicom


and best do
nano /home/pi/.bash_aliases
and add line
alias PICO='minicom -b 115200 -o -D /dev/ttyACM0'


rerun my Arduino IDE install-script on this RPI4
and start it just to use the "monitor" instead the minicom

but for programming the PICO today we can not use the Arduino IDE
i hope that will come soon.


so now is it the situation to learn how to use the above by the script installed tools to make our first own PICO C++ code
let us build one of the examples:
( i use /home/pi/projects/pico/blink/ ) and there have 3 files:
pico_sdk_import.cmake
blink.c
CMakeLists.txt

the first 2 i copy
the
CMakeLists.txtcmake_minimum_required(VERSION 3.12)

include(pico_sdk_import.cmake)

project(blink)

pico_sdk_init()

add_executable(blink
blink.c
)

# Pull in our pico_stdlib which pulls in commonly used features
target_link_libraries(blink pico_stdlib)

# create map/bin/hex/uf2 file etc.
pico_add_extra_outputs(blink)

now use following commands:
mkdir build
cd build
cmake ..
make blink

and find ... blink.uf2 what you can copy to the PICO board


and make a new project where you really start to code ..
i try first a combination of BLINK and Hallo_World_USB


with this we have lots of the prior installed tool tested already, only the big thing:
Visual Studio Code IDE test ( microsoft free ware ) is open:
cd /home/pi/projects/pico/blink/
code

this should open the VSC window and now do:
/open folder / ( like select: projects/pico/blink/ ) OK
/open file /blink/blink.c
for
#include "pico/stdlib.h"
we get a ERROR

here i need to find how to adjust that IDE
try follow https://www.youtube.com/watch?v=Q1Kfg8k54jM
the point was i needed to select a compiler ( tool button )
GCC for arm non-eabi 7.3.1 and build again.
( and just to be sure all works i deleted the old /build/ directory too

and load to PICO for test.


as the PICO has 2 core that concept might be new if you come from old Arduino boards
https://www.youtube.com/watch?v=9vvobRfFOwk


for a easy start with PYTHON get/download the free book
RPi_Pi Pico_Digital Edition.pdf
that helps to setup the PICO for Micro Python ( download and flash )
and use Thonny Python IDE ( like from a Raspbery Pi desktop or install from thonny.org )
a nice video tutorial here


a example project NEO PIXEL
https://www.raspberrypi.org/blog/neopixel-dithering-with-pico/