Your code does exactly what you have written the code to do
Your function varPots only prints this
void varPots() { //varable control of the motors
//Motor 1
speedVal1 = analogRead(speedSet1);
//...
Serial.print("motor1Speed = " );
Serial.print(motor1Speed);
Serial.print(" Switch = ");
Serial.println(val);
delay(5);
}
calling the function varPots from inside function runPGM()
is possible but then you won't need to call it from function loop()
Without re-writing your code to be non-blocking you can't go byond what you have now
a delay() should better have the name
freeze_microcontroller_completely_react_on_nothing_until_freezing_time_is_over()
Here is a first introduction into non-blocking code
It needs more to make your code non-blocking.
But it is very important to understand the fundamental difference between
linear executed blocking code
and
circular executed non-blocking code
best regards Stefan