I need help with controlling a servo

Is there any problems with my code?
I have button inputs on pin 2 and 3 and my servo signal on 4.
The servo is not responding to the buttons.
If needed i will post a fritzing schematic.

#include <Servo.h>

const int buttonPinR = 2;
const int buttonPinL = 3;
Servo myServo; //create servo object to control a servo 
int pos; //servo position variable 
int rButtonState = 0;
int lButtonState = 0;

void setup()
{
  myServo.attach(4); //attaches the servo on pin 4
  pinMode(buttonPinR, INPUT); //set buttonPinR(pin 2) as an input
  pinMode(buttonPinL, INPUT); //set buttonPinL(pin 3) as an input
}
void loop()
{
  rButtonState = digitalRead(buttonPinR);
  lButtonState = digitalRead(buttonPinL);
  
  while(rButtonState = HIGH) 
  {
    ++pos;
    delay(10);
  }
  myServo.write(pos);
}
rButtonState = HIGH)

Always true

As written you would have to install pull-down resistors on the two button inputs. Otherwise enable the internal pull-ups for the two button input pins, wire the buttons between their input pin and ground and change your logic to read LOW as command to move the servo.

Two button servo code that might be of use.

//zoomkat servo button test 12-29-2011
// Powering a servo from the arduino usually *DOES NOT WORK*.

#include <Servo.h>
int button1 = 4; //button pin, connect to ground to move servo
int press1 = 0;
int button2 = 5; //button pin, connect to ground to move servo
int press2 = 0;
Servo servo1;

void setup()
{
  pinMode(button1, INPUT);
  pinMode(button2, INPUT);
  servo1.attach(7);
  digitalWrite(4, HIGH); //enable pullups to make pin high
  digitalWrite(5, HIGH); //enable pullups to make pin high
}

void loop()
{
  press1 = digitalRead(button1);
  if (press1 == LOW)
  {
    servo1.write(170);
  }    
  
  press2 = digitalRead(button2);
  if (press2 == LOW)
  {
    servo1.write(10);
  }
}

After you correct you while loop and change your button to active ground - LOW, take a look at pos using Serial print.
What is the initial value of pos???

Just pushing a button DOES not guarantee the pos value to be in expected range for servo to operate properly.

parkeraph:
Is there any problems with my code?
I have button inputs on pin 2 and 3 and my servo signal on 4.
The servo is not responding to the buttons.
If needed i will post a fritzing schematic.

#include <Servo.h>

const int buttonPinR = 2;
const int buttonPinL = 3;
Servo myServo; //create servo object to control a servo
int pos; //servo position variable 
int rButtonState = 0;
int lButtonState = 0;

void setup()
{
  myServo.attach(4); //attaches the servo on pin 4
  pinMode(buttonPinR, INPUT); //set buttonPinR(pin 2) as an input
  pinMode(buttonPinL, INPUT); //set buttonPinL(pin 3) as an input
Serial.println(pos);
}
void loop()
{
  rButtonState = digitalRead(buttonPinR);
  lButtonState = digitalRead(buttonPinL);
 
Serial.println(pos);

while(rButtonState = HIGH)
  {
    ++pos;
    delay(10);

Serial.println(pos);

}

Serial.println(pos);

myServo.write(pos);
}