Need help with conditional DI/O and using Serial monitor to set conditions

I’m new to the forums, so I apologize ahead of time for any errors I commit. My ultimate goal is to write a sketch that lights three LEDs in a cascading manner. Its quite simple, and I have gotten it to work by itself. The problem comes when I try to incorporate a pseudo “Off switch” into the program. I attempt to assign a value to the variable READ through the serial monitor(SM) . This value is then evaluated to be true or false in an if…else if… structure. If the first if statement is true, it executes the cascade. If the else if statement returns true, it executes “pseudo off”. If neither are true it asks to input a value of 1 or 2.
The program below compiles and is uploaded without error, but when I attempt to interact with the program via SM nothing happens. In addition I have been unable to get Serial.print(“Random String”) to print to the SM. I am using an Arduino Uno with IDE 1.01. I’m guessing I have a fundamental misunderstanding of something below but I can’t seem to catch my mistake. Thanks for the help.

Below is the code discussed above:

int const ledpin4 = 4;
int const ledpin5 = 5;
int const ledpin6 = 6;
int Read = 0;

void setup()
{
  pinMode(ledpin4,OUTPUT);
  pinMode(ledpin5,OUTPUT);
  pinMode(ledpin6,OUTPUT);
  
} //END void setup()

void loop()
{     
   Serial.print("Enter 1 for LED Cascade or 2 for off.");
   Read = Serial.read();
  
   if(Read==1)
    {
     Serial.print("LED Cascade");
      for(int ledpin = 4; ledpin <7; ledpin++)
      {
        digitalWrite(ledpin,HIGH);
        delay(100); // 100ms
        digitalWrite(ledpin,LOW);
      } //END for()
    } //END if()
 
  else if(Read==2)
    {
     Serial.print("LED's Off");
      for(int ledpin = 4; ledpin <7; ledpin++)
       {
          digitalWrite(ledpin,LOW);
       } //End else for()
    } //END else if()
  
  else
    Serial.print("Invalid Entry: Enter 1 or 2");

} //END void loop()

I think, you should check if serial available first.

  if (Serial.available() > 0) {
    incomingByte = Serial.read();
    if (incomingByte == '1') {           
      Read = 1;
    }
}

Than you need to cast "char" received via serial to integer, or you can use an example, when value just set. Not tested.

Thank you very much Magician. I played around with Serial.available() a little bit with a switch case, but I haven't looked into it with any detail. I'll work on it and post the updated code if I make progress.

I modified the code snippet Magician provided from:

if (Serial.available() > 0) {
    incomingByte = Serial.read();
    if (incomingByte == '1') {           
      Read = 1;
    }
}

To the following:

if (Serial.available() > 0) 
   {
    incomingByte = Serial.read();
    if (incomingByte == '1') {           
      Read = 1;
    }
    else
    {
      Read = Serial.read();
    }

**Note incomingByte is global cast as byte.

The completed code is as follows. I hope its a good guide for beginners.

int const ledpin4 = 4;
int const ledpin5 = 5;
int const ledpin6 = 6;
int Read = 0;
byte incomingByte = 0;

void setup()
{
  pinMode(ledpin4,OUTPUT);
  pinMode(ledpin5,OUTPUT);
  pinMode(ledpin6,OUTPUT);
  Serial.begin(9600);
  
} //END void setup()

void loop()
{     
   if (Serial.available() > 0) 
   {
    incomingByte = Serial.read();
    if (incomingByte == '1') {           
      Read = 1;
    }
    else
    {
      Read = Serial.read();
    }
}
  
   if(Read == 1)
    {
      for(int ledpin = 4; ledpin <7; ledpin++)
      {
        digitalWrite(ledpin,HIGH);
        delay(100); // 100ms
        digitalWrite(ledpin,LOW);
       } //END for()
     } //END if()
     
     if(Serial.read() >1)
    {
    if(Read == 2)
    {
     Serial.print("LED's Off");
      for(int ledpin = 4; ledpin <7; ledpin++)
       {
          digitalWrite(ledpin,LOW);
       } //End else for()
    } //END else if()
    } //End of if(Serial.read() >1)
     
     
     
} //END void loop()

You are receiving a char over serial that right, but it also in ASCII code. Assigning

Read = Serial.read();

value of Read would be 31 or 41, don’t remember, google for ascii code of “1”.
Other way, you can try http://arduino.cc/en/Serial/ParseInt

The code I posted works. I could parse Read if I want, but I didn't bother because I was consistent with my conditional statements.

This part is wrong:

if (Serial.available() > 0) 
   {
    incomingByte = Serial.read();   <------ first read
    if (incomingByte == '1') {           
      Read = 1;
    }
    else
    {
      Read = Serial.read();    <------- second read
    }

You know you have at least one byte available but you read two.