|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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();
}
}
};
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Program a Servo? | programmr | Programming | 5 | 10-02-2008 13:12 |
| How to conect solenoids to the circuit board. and how to program it...??? | arpitshah | Pneumatics | 6 | 13-01-2008 15:06 |
| Servo Values to Degrees... How? | mogunus | Programming | 16 | 11-04-2007 02:03 |
| How much do the servo cost? | Ken Leung | Motors | 2 | 14-09-2001 15:42 |