Midi controller octave changer

Here are several coding suggestions:

  1. Instead of using digitalWrite to enable the internal pullup the following is preferred for readability:

pinMode (15, INPUT_PULLUP);

  1. It is customary to put includes at the beginning of the file, followed by constants, followed by gloabl variables, followed by functions.

  2. For integers that will not change you should use the 'const' keyword. That way if your code attempts to overwrite the value the compiler will show an error. For example:

int velocity = 0b1111111; // Maximum velocity (0b1111111 = 0x7F = 127)

should be:

const int velocity = 0b1111111; // Maximum velocity (0b1111111 = 0x7F = 127)

  1. The following is a static initialization happening only once and there fore when saato is updated the array will not be:
Digital Buttonslarge[] = {
  {mux1.pin(0), saato, 1, velocity},
  {mux1.pin(1), a3G2 + saato, 1, velocity},
  {mux1.pin(2), (a5A2 + saato), 1, velocity},
  {mux1.pin(3), a7B2 + saato, 1, velocity},
  {mux1.pin(4), a8C3 + saato, 1, velocity},
  {mux1.pin(5), a10D3 + saato, 1, velocity},
  {mux1.pin(6), a12E3 + saato, 1, velocity},
  {mux1.pin(7), a13F3 + saato, 1, velocity},
  {mux1.pin(8), a15G3 + saato, 1, velocity},
  {mux1.pin(9), a17A3 + saato, 1, velocity},
  {mux1.pin(10), a19B3 + saato, 1, velocity},
  {mux1.pin(11), a20C4 + saato, 1, velocity},
  {mux1.pin(12), a22D4 + saato, 1, velocity},
  {mux1.pin(13), a24E4 + saato, 1, velocity},
};