First, you need to make sure you actually have your servos connected properly and that they actually work, before trying to do something more complex with them. Heres an example MyRobot.cpp that will help you do that (I've compiled this, but haven't tested it -- but it should work just fine).
Code:
#include "WPILib.h"
// define the slot numbers so we don't get confused and
// use 1 and 2 instead of 4 and 6
#define DIGITAL_SLOT_1 4
#define DIGITAL_SLOT_2 6
// PWM channel your servo is in
#define SERVO_CHANNEL 1
class RobotDemo : public SimpleRobot
{
Servo servo;
Joystick stick;
public:
RobotDemo(void):
servo(DIGITAL_SLOT_1, SERVO_CHANNEL),
stick(1)
{
GetWatchdog().SetExpiration(0.1);
}
void OperatorControl(void)
{
GetWatchdog().SetEnabled(true);
while (IsOperatorControl())
{
GetWatchdog().Feed();
// control the servo with a joystick
servo.Set( stick.GetDirectionDegrees() );
Wait(0.005); // wait for a motor update time
}
}
};
START_ROBOT_CLASS(RobotDemo);