View Single Post
  #1   Spotlight this post!  
Unread 04-02-2009, 20:49
ExarKun666's Avatar
ExarKun666 ExarKun666 is offline
Ben Error/MC Ben/NC Ben
AKA: Ben Kellogg
FRC #2429 (LCEC)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2008
Location: La Caņada, CA
Posts: 208
ExarKun666 is an unknown quantity at this point
Send a message via AIM to ExarKun666 Send a message via MSN to ExarKun666 Send a message via Yahoo to ExarKun666
How to Program a Servo

Okay I am not sure how to program the servo, I have a servo plugged into the digital sidecar on PWM #3, and I am not sure how to program it moving so this is the code that we have, so could you tell us our problem?

Code:
#include "WPILib.h"
#include "xmath.h"

class RobotDemo : public SimpleRobot
{
   RobotDrive myRobot;
   Joystick leftstick;
   Joystick rightstick;
   Servo servo;
public:
   RobotDemo(void):
      myRobot(1, 2, 3),
      leftstick(1),
      rightstick(2),
      servo(3)
   {
       GetWatchdog().SetExpiration(100);
   }
   void Autonomous(void)
   {
       GetWatchdog().SetEnabled(false);
       //CODE
    }
void OperationControl(void)
{
   Servo(3);
   GetWatchdog().SetEnabled(true);
   while(IsOperatorControl())
   {
      servo.Set(170.0);
      GetWatchdog().Feed();
   }
}
};
So any suggestions?
__________________
Ben Kellogg




Team Sites: [LCEC Site] [FRC/FLL Site] [LCEC Blog]
Reply With Quote