This example code shows how to interface the Raspberry Pi Pico to a Max7219 driving an 8 digit 7 segment display. The particular device used is interfaced via SPI at 3.3v.
The Max7219 datasheet can be found here https://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf
Wiring up the device requires 5 jumpers as follows:
-
GPIO 17 (pin 22) Chip select → CS on Max7219 board
-
GPIO 18 (pin 24) SCK/spi0_sclk → CLK on Max7219 board
-
GPIO 19 (pin 25) MOSI/spi0_tx → DIN on Max7219 board
-
5v (pin 40) → VCC on Max7219 board
-
GND (pin 38) → GND on Max7219 board
The example here uses SPI port 0. Power is supplied from the 5V pin.
Note
|
There are many different manufacturers who sell boards with the Max7219. Whilst they all appear slightly different, they all have, at least, the same 5 pins required for power and communication. Please ensure you connect up as described in the previous paragraph. |
- CMakeLists.txt
-
CMake file to incorporate the example in to the examples build tree.
- max7219_8x7seg_spi.c
-
The example code.
Item |
Quantity |
Details |
Breadboard |
1 |
generic part |
Raspberry Pi Pico |
1 |
|
max7219 board with 8x7segment LEDs |
1 |
generic part |
M/M Jumper wires |
5 |
generic part |