@kcuk220 No dumb questions at all! To send Portamento Time (CC 5) with your M5Stack Core3S and MIDI Unit in UIFlow 2.0, you'll need to use the cmd_write method to send raw MIDI control change messages. Here's how:
Step 1: Understand the MIDI CC Message Structure
Portamento Time (CC 5) uses this MIDI message format:Bn 05h cc
Bn: Status byte (B = Control Change, n = MIDI channel 0-15 → hex 0-F)
05h: CC number (5 for Portamento Time)
cc: Value (0-127, where 0 = fastest portamento, 127 = slowest)
Step 2: UIFlow 2.0 Implementation
Initialize the MIDI Unit (if not already done):Use the "MIDI Unit" block under "Units" to set up the MIDI Unit with your UART port (e.g., Port A).
Send Portamento CC Message using cmd_write:The cmd_write method accepts a list of MIDI bytes. For Portamento Time on Channel 1 (hex 0), with a value of 64 (medium speed):
Bytes = [0xB0, 0x05, 0x40]
0xB0 = Channel 1 (0xBn where n=0), Control Change
0x05 = CC number 5 (Portamento Time)
0x40 = Value 64 (hex for 64)
Example Code (Blockly & Python)
Blockly:
Add a "MIDI Unit" → "cmd_write" block.
Set the input to [176, 5, 64] (decimal equivalent of 0xB0, 0x05, 0x40).
Python (Advanced):
from m5stack import *
from m5ui import *
from uiflow import *
import unit
midi = unit.get(unit.MIDI, unit.PORTA)
Send Portamento Time (CC 5) on Channel 1, value 64midi.cmd_write([0xB0, 0x05, 0x40]) # B0=Ch1, 05=CC5, 40=64
Key Notes:
Channel Adjustment: Change the first byte to target different channels. For example:
Channel 2 → 0xB1 (hex) or 177 (decimal)
Channel 10 (drums) → 0xB9 (hex) or 185 (decimal).
Value Range: Use 0-127 for cc (e.g., 0x00 = 0 = fastest, 0x7F = 127 = slowest).
Verification
Test with a MIDI monitor (e.g., MIDI-OX on Windows, MIDI Monitor on macOS) to confirm the CC 5 message is received. Most synths require Portamento to be enabled (via CC 65, "Portamento On/Off") before CC 5 takes effect.
https://chat.m5stack.com/