View Single Post
  #1   Spotlight this post!  
Unread 03-02-2014, 10:56
TechWarlock TechWarlock is offline
Programming Dude
AKA: Jacob
FRC #1396 (Pyrobots)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2011
Location: New York
Posts: 24
TechWarlock is an unknown quantity at this point
Solenoid Breakout Code Help

Hi CD!

I was wondering if anyone could take 5 minutes and briefly review our code for the Solenoid Breakout attached to the NI Module 9472.

We code in C++ using Windriver Workbench.

Thanks in advance!

#include "WPIlib.h"
#include "compressor.h"

class RobotDemo : public SimpleRobot
{
RobotDrive Frankbot; // robot drive system
Joystick leftjoy;
Joystick rightjoy;
Joystick joystick3;
Relay Pulley;
Relay piston1;
Relay Arm; // PistonHelper
Relay PistonHelper; //Actual Arm
// Jaguar Winch;


public:
RobotDemo(void):
Frankbot(1, 2), //these are the PWM ports
leftjoy(1),
rightjoy(2),
joystick3(3),
Pulley(2),
piston1(4),
Arm (5),
PistonHelper (8)
// Winch (4)

{
// usermessages = DriverStationLCD::GetInstance();
// Camera->WriteResolution(AxisCamera::kResolution_160x120 );
// Camera->WriteCompression(20);
// Camera->WriteWhite
// Balance(AxisCameraParams::kWhiteBalance_FixedIndoo r);
// Camera->WriteMaxFPS(30);
// Camera = &AxisCamera::GetInstance();
// myRobot.SetExpiration(0.1); // test

}

void Autonomous(void)
{
Compressor *c = new Compressor(1, 1);
c->Start();
}
void OperatorControl(void)
{
Solenoid*solenoidOne;
Solenoid*solenoidTwo;
solenoidOne = new Solenoid(8,1);
solenoidTwo = new Solenoid (8,8);
int up = 4;
int down = 5;
int WinchIn = 2;
int WinchOut = 1;
int ArmIn = 1;
int ArmOut = 2;
int On = 6;
int Off = 3;
int ArmUp = 2;
int ArmDown = 1;
int Sol1 = 3;
int Sol2 = 4;
static float speedModifier = 1.00;
// static float winchspeed = 1.00;
Compressor *c = new Compressor(1, 1);
c->Start();
Frankbot.SetSafetyEnabled(true);

while (IsOperatorControl())
{
if(leftjoy.GetRawButton(Sol1)){
solenoidOne->Set(true);
solenoidTwo->Set(false);
}
else{
solenoidOne->Set(false);
solenoidTwo->Set(true);
}


}
}
};
START_ROBOT_CLASS(RobotDemo);