Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
205 lines (138 sloc) 5.51 KB

Pico Explorer Pack

Our Pico Explorer Pack offers a vibrant 1.14" (240x240) IPS LCD screen for your Raspberry Pi Pico it also includes four switches, a piezo and a DRV8833 motor driver.

We've included helper functions to handle every aspect of drawing to the screen and interfacing with the buttons, piezo and motor driver. See the library reference for details.

Example Program

The following example sets up Pico Explorer, displays some basic demo text and graphics and will illuminate the RGB LED green if the A button is pressed.

#include "pico_explorer.hpp"

using namespace pimoroni;

uint16_t buffer[PicoExplorer::WIDTH * PicoExplorer::HEIGHT];
PicoExplorer pico_explorer(buffer);

int main() {

    // set the backlight to a value between 0 and 255
    // the backlight is driven via PWM and is gamma corrected by our
    // library to give a gorgeous linear brightness range.

    while(true) {

        // now we've done our drawing let's update the screen



Pico Explorer uses our Pico Graphics library to draw graphics and text. For more information read the Pico Graphics function reference..



The four buttons, A, B, X and Y have correponding constants set to their respective GPIO pins. For example:

bool a_is_pressed = pico_explorer.is_pressed(pico_explorer.A);

ADC Channels

The three ADC channels are defined as ADC0, ADC1 and ADC2, and should be used with get_adc, eg:

float adc0_reading = pico_explorer.get_adc(pico_explorer.ADC0);


The 8 general purpose IO pins on the lower Pico Explorer are GP0 through GP7, we've created constants for you to identify them easily. You should use Pico SDK's gpio_get to read a pin, eg:

bool pin_state = gpio_get(pico_explorer.GP0);



Sets up Pico Explorer. init must be called before any other functions since it configures the required PWM and GPIO:



void set_backlight(uint8_t brightness);

Set the display backlight from 0-255.

uint8_t brightness = 128;

Uses hardware PWM to dim the display backlight, dimming values are gamma-corrected to provide smooth brightness transitions across the full range of intensity. This may result in some low values mapping as "off."


void PicoExplorer::set_motor(uint8_t channel, uint8_t action, float speed);

Motors are driven by PWM via an onboard DRV8833, set_motor will set the PWM values for the corresponding channel.

Channel should be one of MOTOR1 or MOTOR2.

Action should be FORWARD, REVERSE or STOP.

Speed should be given as a float between 0.0 and 1.0, eg:

pico_explorer.set_motor(pico_explorer.MOTOR1, pico_explorer.FORWARD, 0.5f);
pico_explorer.set_motor(pico_explorer.MOTOR2, pico_explorer.REVERSE, 0.5f);

And to stop the motor:

pico_explorer.set_motor(pico_explorer.MOTOR1, pico_explorer.STOP);
pico_explorer.set_motor(pico_explorer.MOTOR2, pico_explorer.STOP);


float get_adc(uint8_t channel);

Pico Explorer's ADC channels are connected to Pico's ADC-capable pins 26, 27 and 28 which correspond to channels 0, 1 and 2 respectively. eg:

float reading = pico_explorer.get_adc(pico_explorer.ADC0);

Will perform a 12-bit ADC read and return the result as a float scaled from 0.0f to 1.0f. This value can be plugged directly into a motor, eg:

float reading = pico_explorer.get_adc(pico_explorer.ADC0);
pico_explorer.set_motor(pico_explorer.MOTOR1, pico_explorer.FORWARD, reading);


void set_audio_pin(uint8_t p);

set_audio_pin configures the PIN that Pico Explorer uses for audio output. It should be one of GP0 through GP7, eg:


Note: You must bridge this pin over to the AUDIO pin on the Pico Explorer header in order to drive the onboard Piezo, eg:


void set_tone(uint16_t frequency, float duty = 0.2f);

set_tone will play an audio tone out of your chosen audio pin, if you have bridged that pin to "AUDIO" on the Pico Explorer header then it will sound the onboard Piezo.

uint16_t frequency = 440;


bool is_pressed(uint8_t button);

Reads the GPIO pin connected to one of Pico Explorer's buttons, returning a bool - true if it's pressed and false if it is released.


The button vaule should be a uint8_t denoting a pin, and constants A, B, X and Y are supplied to make it easier. e:

bool is_a_button_pressed = pico_explorer.is_pressed(PicoDisplay::A)


To display your changes on Pico Explorer's screen you need to call update: