LikeToBuildStuff
New member
I just built a MIDI CC controller using a Teensy 3.2. I copied the code that someone else had used and it uses the code below to assign which CC's the six potentiometers on my controller will send.
// define pins and cc codes
const int A_PINS = 6;
const int ANALOG_PINS[A_PINS] = {A0, A1, A2, A3, A4, A5};
const int CCID[A_PINS] = {11, 1, 4, 2, 1, 21};
// a data array and a lagged copy to tell when MIDI changes are required
byte data[A_PINS];
byte dataLag[A_PINS];
// ititialize the ReponsiveAnalogRead objects
ResponsiveAnalogRead analog[]{
///////////////////////////////////////////////////////////////////////////
{ANALOG_PINS[1],true},
{ANALOG_PINS[2],true},
{ANALOG_PINS[3],true},
{ANALOG_PINS[4],true},
{ANALOG_PINS[5],true},
{ANALOG_PINS[0],true},
That works fine, but I'd like to have the ability to update the CC assignments to one of five predefined "sets" while the program is running. I have a selector switch wired up and it's working fine, but I don't know what command could be used to update the CC assignments for the 6 pots while the program is looping. I tried using CCID[A_PINS] = {11, 1, 4, 2, 1, 21}; and that caused an error*, so I'm thinking that command may only work during setup. Any help will be greatly appreciated!
* ERROR:
Arduino: 1.8.13 (Windows 10), TD: 1.53, Board: "Teensy 3.2 / 3.1, MIDI, 96 MHz (overclock), Faster, US English"
CCID[A_PINS] = {11, 11, 11, 1, 1, 11};
^
C:\Users\Family Dell 2016\Documents\Arduino\MIDI_Controller_V5_with-5Banks\MIDI_Controller_V5_with-5Banks.ino:99:17: error: cannot convert '<brace-enclosed initializer list>' to 'const int' in assignment
Error compiling for board Teensy 3.2 / 3.1.
// define pins and cc codes
const int A_PINS = 6;
const int ANALOG_PINS[A_PINS] = {A0, A1, A2, A3, A4, A5};
const int CCID[A_PINS] = {11, 1, 4, 2, 1, 21};
// a data array and a lagged copy to tell when MIDI changes are required
byte data[A_PINS];
byte dataLag[A_PINS];
// ititialize the ReponsiveAnalogRead objects
ResponsiveAnalogRead analog[]{
///////////////////////////////////////////////////////////////////////////
{ANALOG_PINS[1],true},
{ANALOG_PINS[2],true},
{ANALOG_PINS[3],true},
{ANALOG_PINS[4],true},
{ANALOG_PINS[5],true},
{ANALOG_PINS[0],true},
That works fine, but I'd like to have the ability to update the CC assignments to one of five predefined "sets" while the program is running. I have a selector switch wired up and it's working fine, but I don't know what command could be used to update the CC assignments for the 6 pots while the program is looping. I tried using CCID[A_PINS] = {11, 1, 4, 2, 1, 21}; and that caused an error*, so I'm thinking that command may only work during setup. Any help will be greatly appreciated!
* ERROR:
Arduino: 1.8.13 (Windows 10), TD: 1.53, Board: "Teensy 3.2 / 3.1, MIDI, 96 MHz (overclock), Faster, US English"
CCID[A_PINS] = {11, 11, 11, 1, 1, 11};
^
C:\Users\Family Dell 2016\Documents\Arduino\MIDI_Controller_V5_with-5Banks\MIDI_Controller_V5_with-5Banks.ino:99:17: error: cannot convert '<brace-enclosed initializer list>' to 'const int' in assignment
Error compiling for board Teensy 3.2 / 3.1.