In this article we look at an expansion board for the Raspberry Pi Pico that I found on one of my searches online which is designed to test all of the GPIO pins of the Raspberry Pi Pico.
Its a fairly niche board, it is low cost and doesn't really have that many use cases for most users but as always we have a look and give you couple of micropython code examples later on.
You can see this pictured below, the board contains 5 push buttons, 1 potentiometer and 20 leds connected to various GPIO pins.
Here is an image of the pins that this board uses and the function of them, as you can see all used.
This board has a couple of possible use cases
- As a demo board , test whether the GPIO pins of Pico are working
- As a basic expansion board, this module includes LEDs, buttons, and you can test ADC basic function.
Purchase
The board only costs about $2 from A;iexpress
Code
There are a couple of code examples
This is a button test example, simply a case of press a button and an LED will light
from machine import Pin import time led = Pin(15, Pin.OUT) button = Pin(12, Pin.IN, Pin.PULL_UP) button1 = Pin(13, Pin.IN, Pin.PULL_UP) button2 = Pin(14, Pin.IN, Pin.PULL_UP) button3 = Pin(16, Pin.IN, Pin.PULL_UP) button4 = Pin(17, Pin.IN, Pin.PULL_UP) while True: if button.value() & button1.value() & button2.value() & button3.value() & button4.value() : led.low() time.sleep(0.5) elif button.value() | button1.value() | button2.value() | button3.value() | button4.value() : led.high() time.sleep(0.5)
This is an led test example, the LEDs will flash in sequence
from machine import Pin import time led=[28,27,1,0,22,21,3,2,20,19,5,4,15,18,7,6,11,10,9,8]; Pin(led[0], Pin.OUT) Pin(led[1], Pin.OUT) Pin(led[2], Pin.OUT) Pin(led[3], Pin.OUT) Pin(led[4], Pin.OUT) Pin(led[5], Pin.OUT) Pin(led[6], Pin.OUT) Pin(led[7], Pin.OUT) Pin(led[8], Pin.OUT) Pin(led[9], Pin.OUT) Pin(led[10], Pin.OUT) Pin(led[11], Pin.OUT) Pin(led[12], Pin.OUT) Pin(led[13], Pin.OUT) Pin(led[14], Pin.OUT) Pin(led[15], Pin.OUT) Pin(led[16], Pin.OUT) Pin(led[17], Pin.OUT) Pin(led[18], Pin.OUT) Pin(led[19], Pin.OUT) while 1: for i in range(len(led)): j=Pin(led[i], Pin.OUT) Pin(led[0], Pin.OUT).low() Pin(led[1], Pin.OUT).low() Pin(led[2], Pin.OUT).low() Pin(led[3], Pin.OUT).low() Pin(led[4], Pin.OUT).low() Pin(led[5], Pin.OUT).low() Pin(led[6], Pin.OUT).low() Pin(led[7], Pin.OUT).low() Pin(led[8], Pin.OUT).low() Pin(led[9], Pin.OUT).low() Pin(led[10], Pin.OUT).low() Pin(led[11], Pin.OUT).low() Pin(led[12], Pin.OUT).low() Pin(led[13], Pin.OUT).low() Pin(led[14], Pin.OUT).low() Pin(led[15], Pin.OUT).low() Pin(led[16], Pin.OUT).low() Pin(led[17], Pin.OUT).low() Pin(led[18], Pin.OUT).low() Pin(led[19], Pin.OUT).low() time.sleep(0.1) j.high() time.sleep(0.1)