View Single Post
  #12   Spotlight this post!  
Unread 06-02-2010, 17:23
Darkknight512 Darkknight512 is offline
Programmer/Electronics
FRC #3375 (North Stars)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Canada
Posts: 26
Darkknight512 is on a distinguished road
Re: Inverted Turning

PWM 1 is connected to the Jaguar controlling the LEFT motor, and PWM is controlling the RIGHT motor

This is the whole program

Quote:
#include "WPILib.h"
#include "vxWorks.h"
#include "Vision/AxisCamera2010.h"
#include "PCVideoServer.h"

class RobotDemo : public SimpleRobot
{
RobotDrive myRobot; // robot drive system
Joystick stick;

Compressor airc;

public:
RobotDemo(void):
myRobot(1, 2), // these must be initialized in the same order
stick(1), // as they are declared above.

airc(1,1)
{

GetWatchdog().SetExpiration(1.0);
GetWatchdog().SetEnabled(false);

AxisCamera &camera = AxisCamera::getInstance();
camera.writeResolution(k640x480);
camera.writeBrightness(10);
camera.writeCompression(25);

airc.Start();
}

void Autonomous(void)
{
GetWatchdog().SetEnabled(false);
Solenoid *s1;
Solenoid *s2;

s1 = new Solenoid(1);
s2 = new Solenoid(2);

Wait(3.000);
s1->Set(true);
s2->Set(false);
Wait(3.000);
s1->Set(false);
s2->Set(true);
}

void OperatorControl(void)
{
GetWatchdog().SetEnabled(true);
while (IsOperatorControl())
{
GetWatchdog().Feed();
myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
Wait(0.005); // wait for a motor update time
}
}
};

START_ROBOT_CLASS(RobotDemo);
Reply With Quote