Pico-Arduino
|
On Friday I was receiving my Raspberry PI Pico and I had the opportunity to play around with it. Actually most of the time I spent reading the Manuals... The conclusion: interesting - but a little bit too complicated - So I was quite happy to read that Arduino plans to add an official support for this Microcontroller.
However I did not want to wait for the official support to be available, so as a temporary solution, I decided to make my own Arduino API availale as a separate project.
To build the arduino library go to the pico-arduino/Arduino subdirectory
and execute the steps below:
This builds the libarduino.a library and installs it into the lib directory.
You can find the resulting library in the pico-arduino/lib directory.
Let's have a look at the blink example. It conisists of the source code blink.cpp
This looks like a standard Arduino sketch. Please note the following differences however:
#include "Arduino.h"
is mandatoryTo build the example go to the pico-arduino/examples/blink directory and execute the build steps:
The result can be found in the arduino/examples/blink/build directory.
Here is the list of the provided examples
The Pico has 2 processors, so here are the examples which use this Pico specific functionality:
And finally some other Pico specific functionality:
The generated Class documentation can be found in the doc folder
It helps to know the functions of the pins. Here is a copy of the pinout provided by the official Raspberry Pi Pico Documentation:
If a method is requiring a pin you can provide the GPIO number as integer or use the corresponding GP name as given in the sheet above.
The following calls are all identical:
Deployment is very easy - just press the button on your Pico while plugging it to your computer via USB. This will automatically mount the Pico as external drive (RPI-RP2). Finally you just need to copy the generated uf2 file from your build directory to the drive.
That's it!