I am trying to send a midi control change message from my ESP32 to an instrument I have.
My setup is like this:
One ESP32 (remote) acts as a remote that sends data with the press of a button to another ESP32 (servant) via BLE. The servant is attached via the MIDI in to my musical instrument. The idea is that with the press of a button, I can send a midi cc message to the servant which forwards my message over a midi cable to my instrument (causing it to change some stuff in the instrument). Both ESP32s are ESP32-DevKitC V4 (Espressif).
The whole BLE setup is set up on both the remote and the servant. However, the only remaining part is sending the requested control to my musical instrument. I have tried so many things now, that I have no clue any more what to do. It is very hard to know what is going wrong. Right now, when sending data, my instrument doesn't react. A couple of potential flaws in my setup:
- My instrument is broken.
- My wiring is flawed.
- My code is wrong.
- ...
Female DIN 5/180 is connected to my ESP32 with pin 2 to ground, pin 4 with 220 Ohm resistor to 5V and pin 5 to ESP32 Pin 19. My code for sending the midi looks like this now:
Code: Select all
uart = UART(1, 31250, tx=18, rx=19) # init with given baudrate
# uart.init(31250, bits=8, parity=None, stop=1, pins=[18, 19]) # init with given parameters
cc_channel = 0xB0
cc_channel += 0
uart.write(cc_channel)
uart.write(data)
uart.write(struct.pack("I", 127))
I don't see what value I have to present for the CC#, since a cc message needs a value for the control as well I believe. I think it doesn't really matter.The instrument can be controlled by incoming MIDI CC (control change) messages sent by external
MIDI gear.Code: Select all
+-----+--------------+ | CC# | Action | +-----+--------------+ | 49 | Footswitch 1 | | 50 | Footswitch 2 | | ... | ... | +-----+--------------+
Is this the correct approach to send this data over via UART? How do I "compose" a CC message to send over UART?
What does the uart.init provide over the UART constructor?
Thanks in advance <3!
EDIT:
Upon booting, I receive this message:
Code: Select all
I (13353) uart: ALREADY NULL