Receiving information entered on keyboard

Can any one tell me why when i press the 01 or any other number the program doesn't see it and make the appropriate action? Below is some of my code
void loop ()
{
Serial.println ("Press the number of the test that you would like to perform...");
Serial.println ("01 = redLed, 02 = greenLed, 03 = yellowLed, 04 = speaker, 05 = leftPhotoCell");
Serial.println ("06 = rightPhotoCell, 07 = leftIRLed/Detector, 08 = rightIRLed/Detector,");
Serial.println ("09 = pushButton, 10 = leftServo, 11 = rightServo");
Serial.println ("Make your selection");
while ((input = Serial.read()) == -1);

if (Serial.read() == 01)
{

Serial.println ("Testing redLed, the redLed will flash 4 times at 2 Hz");
delay(2000);

digitalWrite (redLed, HIGH);
delay(250);
digitalWrite (redLed, LOW);
delay(250);

Serial.println ("Test Complete");
delay(2000);
}

I don't know how to make the program see what has been entered on the keyboard, and make the decision based on what was entered!

can anyone tell me what piece of code is missing from the below code to recognize what has been entered on the keyboard and use it to make decisions?
void loop ()
{
Serial.println ("Press the number of the test that you would like to perform...");
Serial.println ("01 = redLed, 02 = greenLed, 03 = yellowLed, 04 = speaker, 05 = leftPhotoCell");
Serial.println ("06 = rightPhotoCell, 07 = leftIRLed/Detector, 08 = rightIRLed/Detector,");
Serial.println ("09 = pushButton, 10 = leftServo, 11 = rightServo");
Serial.println ("Make your selection");
while ((input = Serial.read()) == -1);

if (Serial.read() == 01)
{

Serial.println ("Testing redLed, the redLed will flash 4 times at 2 Hz");
delay(2000);

digitalWrite (redLed, HIGH);
delay(250);
digitalWrite (redLed, LOW);
delay(250);

Serial.println ("Test Complete");
delay(2000);
}

Can you not keep starting up new threads on exactly the same topic please? It fractures any attempts to help you.

http://arduino.cc/forum/index.php/topic,61255.0.html

http://arduino.cc/forum/index.php/topic,61301.0.html

I am sorry I was trying to rephrase the question to make it better understood, cause I confused myself with the way it was worded.

baldeagle108:
if (Serial.read() == 01)

Please use the [ code ] tags to make the code more readable. Select it and hit the "#" button above the posting box.

Anyway, if you type in "1" into the serial monitor that is ASCII 1 not binary 1. Example code:

void setup(void)
{
Serial.begin (115200);
}

void loop(void)
{
  
 byte input;
 
  if (Serial.available ())
    {
    input = Serial.read ();
    
    Serial.print ("You typed: ");
    Serial.println (input, DEC);
    
    }  
}

If I type "123" and hit "Send" I see this:

You typed: 49
You typed: 50
You typed: 51

Basically you want to test for '1' not 1. Eg.

if (Serial.read() == '1')

Also I would collect the variable once, because this won't work:

if (Serial.read() == '1')
  {
  // blah blah
  } 
else if (Serial.read() == '2')
  {
  // blah blah
  }

Because you are doing two reads and not one. You want:

input = Serial.read ();
if (input == '1')
  {
  // blah blah
  } 
else if (input == '2')
  {
  // blah blah
  }

Better still, read up on the "switch" statement.