Changing MIDI parameters on my Arduino Nano controller

Hi all. Built several (successful) MIDI controllers, mainly for my Elektron samples/ cycles rig. I fancy doing a new version where I can change parameters (e.g. Pot PO1(A2, 0, 15, 5); is analogue pin2, parameter 16 which is ‘color’ on cycles, 5 is MIDI CH. 5). Tried another analogue in to alter 3rd value 15,16,17,18 (color, shape, sweep, contour), despite the pot returning correct values on Serial Monitor it does not alter that 3rd value, using ‘b’ as the variable. Tried placing the analogeRead etc (lines 26,27,28) in various parts of the code, too no avail. Anyone got any ideas(?) original code lifted from Notes and Volts.
Code below works, changes parameter 16 value as a sequence runs but will not change actual parameter.
*Note my first msg in a forum.

#include <MIDI.h>
#include “Controller.h”

MIDI_CREATE_DEFAULT_INSTANCE();

//—How many potentiometers are connected directly to pins?–
byte NUMBER_POTS = 1;

//DEFINE DIRECTLY CONNECTED POTENTIOMETERS*********************
//Pot (Pin Number, Command, CC Control, Channel Number)
//Command parameter is for future use
int b=16; // initial parameter value
int pot1Pin = A1; //parameter pot
int pot1Value = 0; //initial val;

Pot PO1(A2, 0, b, 5);
//Add pots used to array below like this-> Pot *POTS {&PO1, &PO2, &PO3, &PO4, &PO5, &PO6};
Pot *POTS {&PO1};

void setup() {
MIDI.begin(MIDI_CHANNEL_OFF);
//Serial.begin(9600);
}

void loop() {
pot1Value = (analogRead(pot1Pin));// set function pot
b=map(pot1Value,0,1023,16,20); // set function pot range
Pot PO1(A2, 0, b, 5);
//Serial.println(b);
if (NUMBER_POTS != 0) updatePots();

}

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);

}

}

I presume controllers.h is some sort of 3rd party library. Control surface perhaps?

I’m a little confused by this, it seems b is the cc number and in the loop you are redefining this by reading a pot.

Surely it’s the value you want for the CC number, rather than changing the CC number on the fly.