Pico Explorer Base straps a whole host of physical computing goodies to your Pico - a vibrant 1.14" (240x240) IPS LCD screen, four switches, a piezo buzzer/speaker and a DRV8833 motor driver, as well as handy accessible general purpose inputs and outputs and a built in breadboard.
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](#reference) for details.
- [Example Program](#example-program)
- [Reference](#reference)
- [PicoGraphics](#picographics)
- [Constants](#constants)
- [Buttons](#buttons)
- [ADC Channels](#adc-channels)
- [GPIO](#gpio)
- [Functions](#functions)
- [init](#init)
- [set_motor](#set_motor)
- [get_adc](#get_adc)
- [set_audio_pin](#set_audio_pin)
- [set_tone](#set_tone)
- [is_pressed](#is_pressed)
- [update](#update)
## 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.
// now we've done our drawing let's update the screen
pico_explorer.update();
}
}
```
## Reference
### PicoGraphics
Pico Explorer uses our Pico Graphics library to draw graphics and text. For more information [read the Pico Graphics function reference.](../pico_graphics/README.md#function-reference).
Please note that the backlight on Pico Explorer is not dimmable (we needed the pins to hook up other functions) so the `set_backlight` function is not available for this board.
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:
```c++
bool pin_state = gpio_get(pico_explorer.GP0);
```
### Functions
#### init
Sets up Pico Explorer. `init` must be called before any other functions since it configures the required PWM and GPIO:
`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.
```c++
uint16_t frequency = 440;
pico_explorer.set_tone(frequency);
```
#### is_pressed
```c++
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.
```c++
pico_explorer.is_pressed(button);
```
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: