Stuck in function outside of loop

Using an UNO trying to use the serial monitor to send commands to turn on/off certain colors or blink a led strip. Trouble is once i send one command it works but it doesnt respond to any other commands. Also i really havent figured out how to blink the leds in the function outside of loop. The led has four leads, one power and three colors. The colors are all ground and im using grounding to turn the led on or off. Below is my code.

// Code to work a led strip, change colors or blink by the input number received from the serial monitor.
int pinBlue = 4; // Setting pins and naming ints
int pinRed = 5;
int pinGreen = 6;
char ch = Serial.read();

void pushBlue(char ch) //Blue function
{
digitalWrite (pinBlue,LOW); //Low turns the light on
delay (100); //Quick pause before checking if a new char has been sent
{
Serial.read(); //checking for new char
if
(ch =='1')
pushBlue(ch);

else
digitalWrite (pinBlue,HIGH); //Turns off the blue function
}
}

void pushRed(char ch) //Same as blue function just with red led
{
digitalWrite (pinRed,LOW);
delay (100);
{
Serial.read();
if
(ch =='2')
pushRed(ch);

else
digitalWrite (pinRed,HIGH);
}
}

void pushGreen(char ch)//Same as above
{
digitalWrite (pinGreen,LOW);
delay (100);
{
Serial.read();
if
(ch =='3')
pushGreen(ch);
else
digitalWrite (pinGreen,HIGH);
}
}

void clearColor() //Turns off all leds
{
digitalWrite (pinBlue,HIGH);
digitalWrite (pinRed,HIGH);
digitalWrite (pinGreen,HIGH);
}

char blinkBlue(char ch) //Blinking Blue
{
while (ch =='4')
digitalWrite (pinBlue,LOW);
delay (1000);
digitalWrite (pinBlue,HIGH);
delay (1000);
}

void setup() {
// put your setup code here, to run once:
pinMode (pinBlue, OUTPUT); // Setting the pins as outputs
pinMode (pinRed, OUTPUT);
pinMode (pinGreen, OUTPUT);
digitalWrite (pinBlue,HIGH);
digitalWrite (pinRed,HIGH);
digitalWrite (pinGreen,HIGH);

Serial.begin (9600); //Starting the serial comm and printing line below
Serial.println ("Enter Led Number 1,2,3,4 or x to clear");
}

void loop() {

if (Serial.available()) // Opening if statement follwed by all the diff vars for led's
{
char ch = Serial.read(); // Setting the char ch as the link between the led pins
if (ch =='1')
{
Serial.println ("Turned on LED ");
pushBlue(ch); // Calling the push blue below
}
if (ch =='2') //Same as above and below, just calling different pins from different serial inputs
{
Serial.print("Turned on LED ");
pushRed(ch);
}
if (ch =='3')
{
Serial.print ("Turned on LED ");
pushGreen (ch);
Serial.print ("Turned on LED ");
}
{
if (ch =='x')
Serial.print ("Turned off all LED ");
clearColor ();
}
{
if (ch =='4')
char blinkBlue (char ch);
Serial.print ("Blinking LED ");
Serial.println(ch);
}

}}

I might be wrong but i think its has something to do with the way your using Serial.read

Any reason your code incorrectly uses recursive function call?

Your functions you are doing Serial.read(); when there may not be anything to read.

Only do a read if Serial.available() > 0

Review Robin2’s serial basics.

https://forum.arduino.cc/index.php?topic=288234.0

Also, don’t call your function from your function.

arduino_new:
Any reason your code incorrectly uses recursive function call?

This might not be the best way to help this person out.

What this commenter is referring to is these parts in your code.

void pushBlue(char ch) //Blue function
{
digitalWrite (pinBlue,LOW); //Low turns the light on
delay (100); //Quick pause before checking if a new char has been sent
{
Serial.read(); //checking for new char
if
(ch =='1')
pushBlue(ch); <<<<<------ Right here you call the function thats currently
running. This can get you stuck in the loop endlessly if you mess up.

else
digitalWrite (pinBlue,HIGH); //Turns off the blue function
}
}

Okay makes sence but when I take out calling the function and address the serial.available before serial read issue the led lights up and turns off. It doesnt stay lit until a new command is sent. I am not sure whats turning it off. This is what i changed

void pushBlue(char ch) //Blue function
{
digitalWrite (pinBlue,LOW); //Low turns the light on
delay (100); //Quick pause before checking if a new char has been sent
{

if
(Serial.available()>0);
ch = Serial.read();
}
}