Let’s have a look at the blink example. It conisists of the source code blink.cpp
#include "Arduino.h"
// the setup function runs once when you press reset or power the board
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
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:
mkdir build
cd build
cmake ..
make
The result can be found in the arduino/examples/blink/build directory.
Here is the list of the provided examples using the Arduino functionality
The Pico has 2 processors, so here are the examples which use this Pico specific functionality:
Here is some other Pico specific functionality:
And now some more complex examples:
Audio: