HELP! Error in my code. Controlling Servo Motors using Arduino

Hello,
I’m trying to make one push button a “start” button, and another one a “stop” button. I use “Serial.begin(9600);” but when i try to do “Serial.stop” it doesn’t necessarily work lol. I’m very new to coding. if you could help that’d be great! Thanks in advance

coding in MPIDE & error reads :“error: ‘class HardwareSerial’ has no member named ‘stop’” lol


#include <Servo.h>
Servo myservo;
int pos = 0;
int myDirection;
int buttonA=3;
int buttonB=4;

void setup()
{
myservo.attach(9);
Serial.begin(9600);
Serial.println(“Enter Direction (L or R);”); //prompt user
pinMode(buttonA,INPUT);
Serial.begin(9600);
pinMode(buttonB,INPUT);
Serial.stop(9600);

}

void loop()
{

{
if(Serial.available()); //checks for input
{
myDirection=Serial.read(); //read the input
}if(myDirection==‘L’) //go left
{
if(pos<180){
pos += 1;
}
}
else if(myDirection= ‘R’) //go right
{
if(pos>0) {
pos-+1;
}
}
myservo.write(pos);
delay(15);
}
}

got rid of the line
** Serial.stop(9600);**
at the end of the setup function and it now compiles:

#include <Servo.h>
Servo myservo;
int pos = 0;
int myDirection;
int buttonA = 3;
int buttonB = 4;

void setup()
{
  myservo.attach(9);
  Serial.begin(9600);
  Serial.println("Enter Direction (L or R);");  //prompt user
  pinMode(buttonA, INPUT);
  Serial.begin(9600);
  pinMode(buttonB, INPUT);


}



void loop()
{

  {
    if (Serial.available()); //checks for input
    {
      myDirection = Serial.read(); //read the input
    } if (myDirection == 'L') //go left
    {
      if (pos < 180) {
        pos += 1;
      }
    }
    else if (myDirection = 'R') //go right
    {
      if (pos > 0) {
        pos - +1;
      }
    }
    myservo.write(pos);
    delay(15);
  }
}

how do I set the other button as a "stop" button?

RaynaWolf_: how do I set the other button as a "stop" button?

Your code does not read [u]any[/u] buttons so I am not clear what you are trying to do.

What is it that you are trying to start and stop ?

Your code does not read any buttons so I am not clear what you are trying to do.

And, I'm not sure why you are trying to use the Serial instance to do it. You should almost certainly be using an instance of the LiquidCrystal class, instead.