#doing midi on the pico

1 messages · Page 1 of 1 (latest)

opal drift
#

and then we can see if there are errors from the code itself

zenith coyote
#

everytime i hit stop the same message appears

opal drift
#

oh ok that's the restart button

#

you might have an old version of Thonny

zenith coyote
#

you metioned Mu?

opal drift
zenith coyote
#

installing now

#

just to be clear - I should select RP2040?

opal drift
#

Circuitpython

#

it should detect that there's a Circuitpython board

zenith coyote
#

I had disconnected the pico during the installation, it is now connected and i had selected CircuitPython

opal drift
#

ok, clicking on serial should show the serial output

zenith coyote
opal drift
#

hit ctrl-D to restart the code

#

do you get an error ?

zenith coyote
#

yes error - ImportError: no module named 'adafruit_dotstar'

opal drift
#

aha ! well let's install that then !

zenith coyote
#

okay!

#

Do i get that from the adafruit bundle?

opal drift
#

yeah from the bundle

zenith coyote
#

I just placed the adafruit_dostar in the LIB folder of the CIRCUITPY -> CTRL D ->

opal drift
#

adafruit_dotstar.mpy ?

zenith coyote
opal drift
#

adafruit_dotstar.mpy from the lib directory in the bundle

zenith coyote
#

oops..
I deleated the file folder containing the .xtx file and placed the adafruit_dostar.mpy in the Lib folder on the CIRCUITPY

opal drift
#

ok so it's running now

#

you can add prints in the code to see if the buttons are properly detected, and you need a midi app to see if the midi commands are correctly sent

zenith coyote
#

Right on!.. do i need to install anything for the Pico Display?

opal drift
#

can you link to the product ?

zenith coyote
opal drift
#

so you need that library (adafruit_st7789)

#

if you want to adapt the full code of the learn guide, the display is the easy part, adapt the dimensions and simply substitue the display variable setup for the on for your display

zenith coyote
#

so i should pull the adafruit_st7789 from the bundle download and place the the Lib folder on the CIRCUITPY and then CTRL D?

opal drift
#

you have to add the setup code from the example I linked, like that:

from adafruit_st7789 import ST7789

# Release any resources currently in use for the displays
displayio.release_displays()

tft_cs = board.GP17
tft_dc = board.GP16
spi_mosi = board.GP19
spi_clk = board.GP18
spi = busio.SPI(spi_clk, spi_mosi)

display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)
display = ST7789(
    display_bus, rotation=270, width=240, height=135, rowstart=40, colstart=53
)
#

hmmm it uses the same clock and mosi pins as the DotStar

#

you might have to adapt the pins to your wiring, how is everything wired together ?

zenith coyote
opal drift
#

wait, isn't the display supposed to be connected the other way around ?

zenith coyote
#

I thought I was to match the USB icon to the direction of the USB

opal drift
#

when viewed from the top of the screen, the 3V pin is on the left

#

or from the back of the screen, it's the top of the pico

zenith coyote
#

well.. thats just silly of me.
but now the plot thickens

opal drift
#

now you need to put it on the side and use wires, in a way it helps since you can choose different SPI pins to avoid conflict with the dotstars

zenith coyote
#

gotcha! ill connect the wires as its shown on the pinout

zenith coyote
#

I can use these pins, correct?

opal drift
#

yes

#

the display uses a lot of pins wow

#

I believe you can remap the display SPI pins like this to avoid clashing with the keypad pins:

#

(the blue lines, moving from GP17, 18, 19 to GP9, 10, 11 - note that the pins numbers on the picture are physical pins, not GPIO numbers, check on the pico pinout what the GPIO numbers are)

zenith coyote
#

i'll try that rightr now!