keypad reading three numbers for led rgb

i am using Adafruit_NeoPixel library for manage my led strip, i add to the circuit keypad for read the code for some color as you can see

void singleColor(){
  red = readNumber();
  green = readNumber();
  blu = readNumber();  
  colorWipe(strip.Color(red, green, blu), 50); 
}

the other function :

int readNumber(){
    Serial.println("porcodiooo2");
    int tmp;
    char key = customKeypad.getKey(); 
    
  while(key!='#'){
         switch (key){
         case NO_KEY:
            Serial.println("porcodiooo3");
            key = customKeypad.getKey(); 
            break;
            
         case '0': case '1': case '2': case '3': case '4':
         case '5': case '6': case '7': case '8': case '9':
            Serial.println("letto numero");
            key = customKeypad.getKey(); 
            inputString += key;               // append new character to input string
            break;
              
         case '*':
            key = customKeypad.getKey(); 
            Serial.println("sbagliato");
            inputString = "";
            break;
            
         } 
    }

    inputInt = inputString.toInt(); // YOU GOT AN INTEGER NUMBER
    tmp = inputInt; 
    Serial.println("dentro read controllo #");  
    Serial.println(inputInt);  
    return tmp;
    inputString = ""; 
 }

i call this inside

void loop(){
  char customKey = customKeypad.getKey();
  int key = int(customKey);

  if(key){
    functionWrapper(key);     
  }
  
}

  void functionWrapper(int fun){
    switch (fun) {
    case A:    
     rainbowCycle(20);
      break;
    case B:   
      singleColor();
      break;
    case C:   
      theaterChase(strip.Color(127, 127, 127), 50); // White
      break;
    case D:    
      turnoff();
      break;
  }
  delay(1);        // delay in between reads for stability
    
  }

i need to stop the loop until it read 3 values, so i can use :

 colorWipe()

any advice?

Well of course the error here is in this suggestion of “stop the loop”.

You need to study this thread to understand how coding works. :sunglasses: