Error message: no match to operator&' (operand type are Pot** and Pot

I need help trying to make my first midi controller using a Arduino Uno with midiout and two 16 input multiplexes that are connected in Analog inputs A0 and A1 of the Arduino. On the A0 input Mux 1 I have used inputs 0 to 13 on the 1st multiplexer and on the A1 input Mux 2 I have used inputs 0 to 9 on the second resulting in 24 potentiometers.

Processing: MIDI_Controller_Watts_up.ino...

#include <MIDI.h>
#include "Controller.h"

/*************************************************************
  MIDI CONTROLLER

  by Notes and Volts
  www.notesandvolts.com

  Version 1.2 **Arduino UNO ONLY!**
 *************************************************************/

MIDI_CREATE_DEFAULT_INSTANCE();

//************************************************************
//***SET THE NUMBER OF CONTROLS USED**************************
//************************************************************
//---How many buttons are connected directly to pins?---------
byte NUMBER_BUTTONS = 0;
//---How many potentiometers are connected directly to pins?--
byte NUMBER_POTS = 0;
//---How many buttons are connected to a multiplexer?---------
byte NUMBER_MUX_BUTTONS = 0;
//---How many potentiometers are connected to a multiplexer?--
byte NUMBER_MUX_POTS = 24;
//************************************************************

//***ANY MULTIPLEXERS? (74HC4067)************************************
//MUX address pins must be connected to Arduino UNO pins 2,3,4,5
//A0 = PIN2, A1 = PIN3, A2 = PIN4, A3 = PIN5
//*******************************************************************
//Mux NAME (OUTPUT PIN, , How Many Mux Pins?(8 or 16) , Is It Analog?);


Mux M1(A0, 16, true); //Analog multiplexer on Arduino analog pin A0
Mux M2(A1, 16, true); //Analog multiplexer on Arduino analog pin A1




//*******************************************************************


//***DEFINE DIRECTLY CONNECTED POTENTIOMETERS************************
//Pot (Pin Number, Command, CC Control, Channel Number)
//**Command parameter is for future use**

//Pot PO1(A0, 0, 1, 1);
//Pot PO2(A1, 0, 10, 1);
//Pot PO3(A2, 0, 22, 1);
//Pot PO4(A3, 0, 118, 1);
//Pot PO5(A4, 0, 30, 1);
//Pot PO6(A5, 0, 31, 1);
//*******************************************************************
//Add pots used to array below like this->  Pot *POTS[] {&PO1, &PO2, &PO3, &PO4, &PO5, &PO6};
Pot *POTS[] {};
//*******************************************************************


//***DEFINE DIRECTLY CONNECTED BUTTONS*******************************
//Button (Pin Number, Command, Note Number, Channel, Debounce Time)
//** Command parameter 0=NOTE  1=CC  2=Toggle CC **

//Button BU1(2, 0, 60, 1, 5 );
//Button BU2(3, 0, 61, 1, 5 );
//Button BU3(4, 0, 62, 1, 5 );
//Button BU4(5, 0, 63, 1, 5 );
//Button BU5(6, 0, 64, 1, 5 );
//Button BU6(7, 0, 65, 1, 5 );
//Button BU7(8, 1, 64, 1, 5 );
//Button BU8(9, 2, 64, 1, 5 );
//*******************************************************************
//Add buttons used to array below like this->  Button *BUTTONS[] {&BU1, &BU2, &BU3, &BU4, &BU5, &BU6, &BU7, &BU8};
Button *BUTTONS[] {};
//*******************************************************************


//***DEFINE BUTTONS CONNECTED TO MULTIPLEXER*************************
//Button::Button(Mux mux, byte muxpin, byte command, byte value, byte channel, byte debounce)
//** Command parameter 0=NOTE  1=CC  2=Toggle CC **

//Button MBU1(M3, 0, 0, 70, 1, 5);
//Button MBU2(M3, 1, 1, 71, 1, 5);
//Button MBU3(M3, 2, 2, 72, 1, 5);
//Button MBU4(M3, 3, 0, 73, 1, 5);
//Button MBU5(M3, 4, 0, 74, 1, 5);
//Button MBU6(M3, 5, 0, 75, 1, 5);
//Button MBU7(M3, 6, 0, 76, 1, 5);
//Button MBU8(M3, 7, 0, 77, 1, 5);
//Button MBU9(M3, 8, 0, 78, 1, 5);
//Button MBU10(M3, 9, 0, 79, 1, 5);
//Button MBU11(M3, 10, 0, 80, 1, 5);
//Button MBU12(M3, 11, 0, 81, 1, 5);
//Button MBU13(M3, 12, 0, 82, 1, 5);
//Button MBU14(M3, 13, 0, 83, 1, 5);
//Button MBU15(M3, 14, 0, 84, 1, 5);
//Button MBU16(M1, 15, 0, 85, 1, 5);
//*******************************************************************
////Add multiplexed buttons used to array below like this->  Button *MUXBUTTONS[] {&MBU1, &MBU2, &MBU3, &MBU4, &MBU5, &MBU6.....};
Button *MUXBUTTONS[] {};

//*******************************************************************


//***DEFINE POTENTIOMETERS CONNECTED TO MULTIPLEXER*******************
//Pot::Pot(Mux mux, byte muxpin, byte command, byte control, byte channel)
//**Command parameter is for future use**

Pot MPO1(M1, 0, 0, 32, 1);
Pot MPO2(M1, 1, 0, 33, 1);
Pot MPO3(M1, 2, 0, 34, 1);
Pot MPO4(M1, 3, 0, 35, 1);
Pot MPO5(M1, 4, 0, 36, 1);
Pot MPO6(M1, 5, 0, 37, 1);
Pot MPO7(M1, 6, 0, 38, 1);
Pot MPO8(M1, 6, 0, 39, 1);
Pot MPO9(M1, 8, 0, 40, 1);
Pot MPO10(M1, 9, 0, 41, 1);
Pot MPO11(M1, 10, 0, 42, 1);
Pot MPO12(M1, 11, 0, 43, 1);
Pot MPO13(M1, 12, 0, 44, 1);
Pot MPO14(M1, 13, 0, 45, 1);
Pot MPO15(M2, 0, 0, 46, 1);
Pot MPO16(M2, 1, 0, 47, 1);
Pot MPO17(M2, 2, 0, 48, 1);
Pot MPO18(M2, 3, 0, 49, 1);
Pot MPO19(M2, 4, 0, 50, 1);
Pot MPO20(M2, 5, 0, 51, 1);
Pot MPO21(M2, 6, 0, 52, 1);
Pot MPO22(M2, 7, 0, 53, 1);
Pot MPO23(M2, 8, 0, 54, 1);
Pot MPO24(M2, 9, 0, 55, 1);


//*******************************************************************
//Add multiplexed pots used to array below like this->  Pot *MUXPOTS[] {&MPO1, &MPO2, &MPO3, &MPO4, &MPO5, &MPO6.....};
Pot *MUXPOTS[] {&MPO1, MPO2};
//*******************************************************************


void setup() {
  MIDI.begin(MIDI_CHANNEL_OFF);
}

void loop() {
  if (NUMBER_BUTTONS != 0) updateButtons();
  if (NUMBER_POTS != 0) updatePots();
  if (NUMBER_MUX_BUTTONS != 0) updateMuxButtons();
  if (NUMBER_MUX_POTS != 0) updateMuxPots();
}


//*****************************************************************
void updateButtons() {

  // Cycle through Button array
  for (int i = 0; i < NUMBER_BUTTONS; i = i + 1) {
    byte message = BUTTONS[i]->getValue();

    //  Button is pressed
    if (message == 0) {
      switch (BUTTONS[i]->Bcommand) {
        case 0: //Note
          MIDI.sendNoteOn(BUTTONS[i]->Bvalue, 127, BUTTONS[i]->Bchannel);
          break;
        case 1: //CC
          MIDI.sendControlChange(BUTTONS[i]->Bvalue, 127, BUTTONS[i]->Bchannel);
          break;
        case 2: //Toggle
          if (BUTTONS[i]->Btoggle == 0) {
            MIDI.sendControlChange(BUTTONS[i]->Bvalue, 127, BUTTONS[i]->Bchannel);
            BUTTONS[i]->Btoggle = 1;
          }
          else if (BUTTONS[i]->Btoggle == 1) {
            MIDI.sendControlChange(BUTTONS[i]->Bvalue, 0, BUTTONS[i]->Bchannel);
            BUTTONS[i]->Btoggle = 0;
          }
          break;
      }
    }

    //  Button is not pressed
    if (message == 1) {
      switch (BUTTONS[i]->Bcommand) {
        case 0:
          MIDI.sendNoteOff(BUTTONS[i]->Bvalue, 0, BUTTONS[i]->Bchannel);
          break;
        case 1:
          MIDI.sendControlChange(BUTTONS[i]->Bvalue, 0, BUTTONS[i]->Bchannel);
          break;
      }
    }
  }
}
//*******************************************************************
void updateMuxButtons() {

  // Cycle through Mux Button array
  for (int i = 0; i < NUMBER_MUX_BUTTONS; i = i + 1) {

    MUXBUTTONS[i]->muxUpdate();
    byte message = MUXBUTTONS[i]->getValue();

    //  Button is pressed
    if (message == 0) {
      switch (MUXBUTTONS[i]->Bcommand) {
        case 0: //Note
          MIDI.sendNoteOn(MUXBUTTONS[i]->Bvalue, 127, MUXBUTTONS[i]->Bchannel);
          break;
        case 1: //CC
          MIDI.sendControlChange(MUXBUTTONS[i]->Bvalue, 127, MUXBUTTONS[i]->Bchannel);
          break;
        case 2: //Toggle
          if (MUXBUTTONS[i]->Btoggle == 0) {
            MIDI.sendControlChange(MUXBUTTONS[i]->Bvalue, 127, MUXBUTTONS[i]->Bchannel);
            MUXBUTTONS[i]->Btoggle = 1;
          }
          else if (MUXBUTTONS[i]->Btoggle == 1) {
            MIDI.sendControlChange(MUXBUTTONS[i]->Bvalue, 0, MUXBUTTONS[i]->Bchannel);
            MUXBUTTONS[i]->Btoggle = 0;
          }
          break;
      }
    }
    //  Button is not pressed
    if (message == 1) {
      switch (MUXBUTTONS[i]->Bcommand) {
        case 0:
          MIDI.sendNoteOff(MUXBUTTONS[i]->Bvalue, 0, MUXBUTTONS[i]->Bchannel);
          break;
        case 1:
          MIDI.sendControlChange(MUXBUTTONS[i]->Bvalue, 0, MUXBUTTONS[i]->Bchannel);
          break;
      }
    }
  }
}
//***********************************************************************
void updatePots() {
  for (int i = 0; i < NUMBER_POTS; i = i + 1) {
    byte potmessage = POTS[i]->getValue();
    if (potmessage != 255) MIDI.sendControlChange(POTS[i]->Pcontrol, potmessage, POTS[i]->Pchannel);
  }
}
//***********************************************************************
void updateMuxPots() {
  for (int i = 0; i < NUMBER_MUX_POTS; i = i + 1) {
    MUXPOTS[i]->muxUpdate();
    byte potmessage = MUXPOTS[i]->getValue();
    if (potmessage != 255) MIDI.sendControlChange(MUXPOTS[i]->Pcontrol, potmessage, MUXPOTS[i]->Pchannel);
  }
}

You have an error in the code you don't post.

... and pictures of text are never a good thing.

help me understand if you can I am so green to the matter. Thank You.
Now I have a new error can not convert Pot to Pot** in initialization.

Take a few moments to read this: How to get the best out of this forum - Using Arduino / Installation & Troubleshooting - Arduino Forum
And then post your code here, using code tags as well as your error message, also with code tags.
It will help people help you.

You didn't follow the instructions. There should be an '&' in front of 'MPO2' in your list.

1 Like

Why the extra step of using pointers? Just make an array of Pot objects:

Pot muxPots[] = {
  {M1, 0, 0, 32, 1},
  {M1, 1, 0, 33, 1},
  {M1, 2, 0, 34, 1},
  //
  //
  {M2, 9, 0, 55, 1}
};
1 Like