MIDI messages for presets up/down??

Hi!
Ive searched the forum and internet for too many days without finding any answer...

Im making my own DIY midi foot-controller (using Teensy with Arduino software), and just want two buttons
(a lot like the TC Electronic G-minor) for changing presets up and down on my TC Electronic Nova System.

Ive managed to send ProgramChanges to select a specific preset, but nothing more...
Looking thru the manual of the G-minor it says Ctrl. 82 and 83, but I have not managed to send that specific
message to the Nova System. Im not sure how to write the code:
MIDI.send(CC, 83, 0, 1); // ????
MIDI.send(CC, 83, 127, 1); // ????

It only receives midi messages (blinks) and just sits there staring at me :~

Sooooo...

What is the midi message I need to send to my Nova System to change preset up and down?
Is there any? Or is there a code combination to increase/decrease ProgramChange?

And to the programmers out there; how do I write it?
Whats the code?

Ive used too many hours searching around, all suggestions are sooo welcome :slight_smile:

-Berg

You send MIDI through the serial port so any messages you send look like serial print statements. This piece of code is a function to send CC messages:-

void controlSend(char data1, char data2) {   // where  data1 is the CC number and data2 is the value
  byte cmd = 0xB0 | byte(midiChannel);  // merge channel number
  Serial.print(cmd, BYTE);
  Serial.print(data1, BYTE);
  Serial.print(data2, BYTE);
}

You need to have set a global variable midiChannel which goes from 0 to 15. The MIDI interface gives the illusion it uses channels 1 to 16 but the number it actually sends is one less than the channel number.

If you are outputting code directly from your arduino then you need to set the right serial speed in the setup() function:-
Serial.begin(31250); // MIDI speed

I did it few months back.

Simple one : https://sites.google.com/site/bharatbhushankonka/home/diy-midi-over-usb-using-arduino-uno

a bit more advanced : https://sites.google.com/site/bharatbhushankonka/home/usb-midi-footcontroler-2-0

Hi!

Thanks for the replies!
Unfortunately this doesnt work on my system...

I`ve contacted TCElectronics about the NovaSystem, and they told me that it can only respond to
programchanges, not controlchanges.

So I need to increase/decrease the program change numbers somehow...

This code makes my NovaSystem change from one preset to another when I push switch 1;

#include <MIDI.h>




void setup() {                
  MIDI.begin();
  MIDI.setInputChannel(1);
  pinMode(1, INPUT_PULLUP);
  pinMode(2, INPUT_PULLUP);
 


}


void loop()                     
{
  if (digitalRead(1) == HIGH) {
    //MIDI.sendControlChange(80, 127, 1);
    
  } else {
    


    MIDI.sendProgramChange(30, 1);
    delay(400);
    MIDI.sendProgramChange(35, 1);
    delay(400);
    

    
  }
  delay(250);
}

Is there a simple code that increases / decreases the programchange?
I havent been able to find any easy description on how to do this...

Im also very new on this, so please give me a heads up, I dont fully understand the "MIDI vs Serial" coding :astonished:

Try this, it is not tested or anything. Your example used pin 1, that is not a good idea as that interferes with the serial port, so use pin 2 for the up push button and pin 3 for the down. Just wire the buttons from the pin to ground.

#include <MIDI.h>

int progNo = 30;
int upLastTime, downLastTime, upNow, downNow;

void setup() {                
  MIDI.begin();
  MIDI.setInputChannel(1);
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  digitalWrite(2, HIGH); // enable pull up
  digitalWrite(3, HIGH); // enable pull up
  upLastTime = digitalRead(2);
  downLastTime = digitalRead(3);
}



void loop()                     
{
  upNow = digitalRead(2);
  downNow = digitalRead(3);

  if (upNow == HIGH && upLastTime == LOW) {
     progNo++; // increment program change
     if(progNo > 127) progNo = 127; // stop it going too high
     MIDI.sendProgramChange(byte(progNo), 1);
     delay(20); // bit of debounce delay
  } 
    
  if (downNow == HIGH && downLastTime == LOW) {
     progNo--; // decrement program change
     if(progNo < 0) progNo = 0; // stop it going too low
     MIDI.sendProgramChange(byte(progNo), 1);
     delay(20); // bit of debounce delay
  } 

   upLastTime= upNow;
   downLastTime = downNow;
  delay(200);
}

EDIT - added missing semicolon

Wow!

Thanks for quick reply, and IT WORKS! :slight_smile:

Fantastic, this (easy) thing has been a pain...

For others out there, I needed to add a ; after upnow to make it load:

#include <MIDI.h>

int progNo = 30;
int upLastTime, downLastTime, upNow, downNow;

void setup() {                
  MIDI.begin();
  MIDI.setInputChannel(1);
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  digitalWrite(2, HIGH); // enable pull up
  digitalWrite(3, HIGH); // enable pull up
  upLastTime = digitalRead(2);
  downLastTime = digitalRead(3);
}



void loop()                     
{
  upNow = digitalRead(2);
  downNow = digitalRead(3);

  if (upNow == HIGH && upLastTime == LOW) {
     progNo++; // increment program change
     if(progNo > 127) progNo = 127; // stop it going too high
     MIDI.sendProgramChange(byte(progNo), 1);
     delay(20); // bit of debounce delay
  } 
    
  if (downNow == HIGH && downLastTime == LOW) {
     progNo--; // decrement program change
     if(progNo < 0) progNo = 0; // stop it going too low
     MIDI.sendProgramChange(byte(progNo), 1);
     delay(20); // bit of debounce delay
  } 

   upLastTime = upNow;
   downLastTime = downNow;
  delay(200);
}

And THANKS again! :slight_smile:

Sorry about the missing ; as I didn't have the MIDI library I couldn't do a test compile. Glad it is working. Can you follow what it is doing?

Olá. Tentei compilar este código, mas está dando um erro: 'MIDI' was not declared in this scope.

Alguém sabe como posso resolver isso?

You have not installed the MIDI libiary.

O. Consegui resolver. Inclui a libray MIDI.h

bergmusic:
Wow!

Thanks for quick reply, and IT WORKS! :slight_smile:

Fantastic, this (easy) thing has been a pain...

For others out there, I needed to add a ; after upnow to make it load:

#include <MIDI.h>

int progNo = 30;
int upLastTime, downLastTime, upNow, downNow;

void setup() {               
  MIDI.begin();
  MIDI.setInputChannel(1);
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  digitalWrite(2, HIGH); // enable pull up
  digitalWrite(3, HIGH); // enable pull up
  upLastTime = digitalRead(2);
  downLastTime = digitalRead(3);
}

void loop()                   
{
  upNow = digitalRead(2);
  downNow = digitalRead(3);

if (upNow == HIGH && upLastTime == LOW) {
    progNo++; // increment program change
    if(progNo > 127) progNo = 127; // stop it going too high
    MIDI.sendProgramChange(byte(progNo), 1);
    delay(20); // bit of debounce delay
  }
   
  if (downNow == HIGH && downLastTime == LOW) {
    progNo--; // decrement program change
    if(progNo < 0) progNo = 0; // stop it going too low
    MIDI.sendProgramChange(byte(progNo), 1);
    delay(20); // bit of debounce delay
  }

upLastTime = upNow;
  downLastTime = downNow;
  delay(200);
}




And THANKS again! :)

just my two cents. instead of stop to increase the program number if reached 127, you can set back to 0. so after 127, it back to 0, and continue to increase

---> 127, 0, 1, 2, 3, ...

also for the decrease. so if you want go to program number 1, and your current program number is 120, you don't have to decrease so many