UART won't send all MIDI control messages [solved]
Posted: Sat Mar 06, 2021 7:21 am
I am trying to send some MIDI messages through the UART. I am finding that every message above 0xB0 produces nothing on the output as seen by the MIDI monitor app on a Mac.
This is the code I am using:-
Is there something wrong with me using chr(), if so how do you send defined bytes?
Other messages like note on and note off work this way.
This is the code I am using:-
Code: Select all
"""
MicroPython code to write from UART1 on the Pico
sends some MIDI messages
"""
from machine import UART
from machine import Pin
ser = UART(1, 31250, tx=Pin(8), rx=None) # no recieve
# send control message - works OK
ser.write(chr(0xB0))
ser.write(chr(0x00)) # write bank select msb
ser.write(chr(0x00)) # set to a zero
# send a program change message - produces nothing
ser.write(chr(0xC0))
ser.write(chr(27))
# ask for retune - produces nothing
ser.write(chr(0xF8))
Other messages like note on and note off work this way.