how to create midi change mode from note,to Control change or program change

Hi, i'm newbie and sorry for my english,

i'm just interest to create USB midi controller i'm success to program it to single Note change, Control Change, and program change one a time with change code and upload

how can i do a multi function change (like to change mode with holding switch) to let same switch can function other mode without re-code re-upload

i use some code like below,

   pinMode(2, INPUT_PULLUP);
   pinMode(3, INPUT_PULLUP);
   pinMode(4, INPUT_PULLUP);
   pinMode(5, INPUT_PULLUP);
 }

 void loop() {

 button0.update();
 button1.update();
 button2.update();
 button3.update();
 button4.update();
 button5.update();


//Send control change
 if (button0.fallingEdge()) {
 usbMIDI.sendControlChange(3, 127, channel); //cc03
 }
 if (button1.fallingEdge()) {
 usbMIDI.sendControlChange(4, 127, channel); //cc04
 }
 
 if (button2.fallingEdge()) {
 usbMIDI.sendControlChange(5, 127, channel); //cc05
 }
 
 if (button3.fallingEdge()) {
 usbMIDI.sendControlChange(6, 127, channel); //cc06
 }
  
 if (button4.fallingEdge()) {
 usbMIDI.sendControlChange(7, 127, channel); //cc06
 }
 
 if (button5.fallingEdge()) {
 usbMIDI.sendControlChange(8, 127, channel); //cc06
 }


 // Reset button
 if (button0.risingEdge()) {
 usbMIDI.sendControlChange(3, 0, channel); //cc03
 }
 if (button1.risingEdge()) {
 usbMIDI.sendControlChange(4, 0, channel); //cc04
 }
  if (button2.risingEdge()) {
 usbMIDI.sendControlChange(5, 0, channel); //cc05
 }
  if (button3.risingEdge()) {
 usbMIDI.sendControlChange(6, 0, channel); //cc06
 }
   if (button4.risingEdge()) {
 usbMIDI.sendControlChange(7, 0, channel); //cc06
 }
   if (button5.risingEdge()) {
 usbMIDI.sendControlChange(8, 0, channel); //cc06
 }

 

 while (usbMIDI.read()) {
 // ignore incoming messages
 }
 
 }

please I need some advice here.

i use some code like below,

We don't need code "like" you use, we need the actual code you use then we can see what you need.

Basically you need to use a compound "if" statement that tests for more than one thing. For example:-

 if (button1.fallingEdge() && digitalRead(shiftPin) == LOW) {
 usbMIDI.sendControlChange(4, 127, channel); //cc04
 }

if (button1.fallingEdge() && digitalRead(shiftPin) == HIGH) {
 usbMIDI.sendControlChange(33, 127, channel); //cc33
 }

The && symbol is for a logical AND, both tests have to be true before the code after the if is executed.

very sorry for my bad english, for "like" i mean that exact code that what i used.

and thanks for suggest my coding I'll look into that.

for about option the topic question, I want to code that same button can do "Note change","Control change", "Program change" by somehow to change these mode that i dont know how to do that, not any example code that I do research show how to do this option, but commercial midi control product can change this mode by hold button, etc.

sorry again about my english, and if I can't clarify what I want, please let me know i'll try again.

for "like" i mean that exact code that what i used.

Well no. You have at least missed out the first line of the setup function definition, and who know what else.

want to code that same button can do "Note change","Control change", "Program change" by somehow to change these mode that i dont know how to do that, not any example code that I do research show how to do this option, but commercial midi control product can change this mode by hold button, etc.

Just like I showed you but instead of just sending a different note you send your controll change message.

Hi, Thanks for the reply, but may be I’m missed something. If i understand correctly that’s mean I have to change the code and upload per time?

this video is represent my need and I’m trying to duplicate their function, but I don’t know is it possible to do with arduino or not

thanks.

If i understand correctly that's mean I have to change the code and upload per time?

I don’t know what you mean by per time. But there is no need to change any code mid run, even if you could do such a thing, which you can’t.

I want to code that same button can do "Note change","Control change", "Program change"

If you want a choice of three things for a single button then you need to count the number of times the shift button has been pressed. Do this with the state change code example that is in the IDE. Then use that count in the compound if statements like I showed you.

Restrict the count to three states, that is the numbers zero to two, and it is probably better if you also have three LEDs to denote what mode he buttons are currently in.

I my opinion that video shows a rubbish way of changing modes.