Code Won't Repeat

/*

  • serial_control.pde
  • -------0

#define LED 13
int LED2 = 12;

int input = 0; // variable to keep the data from the serial port

void setup() {
pinMode(LED,OUTPUT); // declare the LED's pin as output

Serial.begin(9600); // connect to the serial port
}

void loop () {
while(Serial.available()){
input = Serial.read(); // read the serial port

// if the input is '1' turn the LED ON, if '0' turn it OFF
if (input == '1' ) {
Serial.println("LEDS are Now On");
digitalWrite(LED , HIGH);
delay(500);
digitalWrite(LED , LOW);

}
else if(input == 0){
Serial.print("Program Terminated.");

}

else{
Serial.println("Sorry, that is not a valid input.");
Serial.println("You tried inputing:");
Serial.println(input);
Serial.println("Valid Commands are 0 and 1.");
}
}

}

The code won't go on a loop in the if statement, why?

The code won't go on a loop in the if statement, why?

Because you've read everything in the serial input buffer?

Ready ge how to use this forum sticky post and use the correct code tags when posting code.

 else if(input == 0){

What about the quote marks?

You don't describe what happens when you run the program but here are some observations.

input is defined as an int.
Later in the code you check to see whether input is a char. ('1')
Later you check to see whether it is zero. (0)
Both of them can't be right, can they ?

What line ending(s) have you got set in the Serial monitor ?