Go to Post Gotta love it... FIRST's GDC...providing entertainment to loads of bored Bostonian FIRST'ers on a friday night. - Andy Grady [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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);
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 22:04.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi