code causing servo motor to stop

i want a servo motor to rotate 90 degrees and stop at the position until an input character is given to make it rotate to 90 degreees to its initial position. please help with the code.

@kgupta79, do not post technical questions in the Introductory Tutorials section.

Do not hijack.

Do not cross-post.

Other post removed.

What have you tried so far ?

Have you got code to make the servo move ? Have you got code to read the input ?

Here you go.

#include <Servo.h>
const byte ServoPin = 2;
Servo myServo;
void setup()
{
  Serial.begin(115200);
  while (!Serial);


  myServo.write(0);
  myServo.attach(ServoPin);
  myServo.write(90);


  while (!Serial.available());  // Wait for a character to arrive


  myServo.write(0);
}
void loop() {} // Do nothing after setup()