|
Re: How to hook up Nason pressure switch
I can't seem to get the compressor to turn on with the relay. I put in the code (C++)
#include "WPILib.h"
#include "vxWorks.h"
#include "Vision/AxisCamera2010.h"
#include "PCVideoServer.h"
#include "Compressor.h"
#include "Utility.h"
#include "DriverStationLCD.h"
class RobotDemo : public SimpleRobot
{
RobotDrive myRobot; // robot drive system
Joystick stick;
public:
RobotDemo(void):
myRobot(1, 2), // these must be initialized in the same order
stick(1) // as they are declared above.
{
GetWatchdog().SetExpiration(1.0);
GetWatchdog().SetEnabled(false);
AxisCamera &camera = AxisCamera::getInstance();
camera.writeResolution(k640x480);
camera.writeBrightness(10);
camera.writeCompression(25);
Compressor *airc = new Compressor (1,1);
airc->Start();
}
void Autonomous(void)
{
GetWatchdog().SetEnabled(false);
myRobot.Drive(0.5, 0.0); // drive forwards half speed
Wait(2.0); // for 2 seconds
myRobot.Drive(0.0, 0.0); // stop robot
}
void OperatorControl(void)
{
GetWatchdog().SetEnabled(true);
while (IsOperatorControl())
{
GetWatchdog().Feed();
myRobot.ArcadeDrive(stick);
Wait(0.005); // wait for a motor update time
}
}
};
START_ROBOT_CLASS(RobotDemo);
|