providing named objects for each of the robot interfaces.
*/
BuiltinDefaultCode(void) {
printf("BuiltinDefaultCode Constructor Started
");
// Create a robot using standard right/left robot drive on PWMS 1, 2, 3, and #4
m_robotDrive = new RobotDrive(1, 3, 2, 4);
// Acquire the Driver Station object
m_ds = DriverStation::GetInstance();
m_priorPacketNumber = 0;
m_dsPacketsReceivedInCurrentSecond = 0;
// Define joysticks being used at USB port #1 and USB port #2 on the Drivers Station
m_rightStick = new Joystick(1);
m_leftStick = new Joystick(2);
// Iterate over all the buttons on each joystick, setting state to false for each
UINT8 buttonNum = 1; // start counting buttons at button 1
for (buttonNum = 1; buttonNum <= NUM_JOYSTICK_BUTTONS; buttonNum++) {
m_rightStickButtonState[buttonNum] = false;
m_leftStickButtonState[buttonNum] = false;
}
// Declare variable to Activate the Compressor
Compressor *compressor=new Compressor(1,1);
compressor ->Start();
// Iterate over all the solenoids on the robot, constructing each in turn
UINT8 solenoidNum = 1; // start counting solenoids at solenoid 1
for (solenoidNum = 1; solenoidNum <= NUM_SOLENOIDS; solenoidNum++)
{
m_solenoids[solenoidNum] = new Solenoid(solenoidNum);
}
// Set drive mode to uninitialized
m_driveMode = UNINITIALIZED_DRIVE;
// Initialize counters to record the number of loops completed in autonomous and teleop modes
m_autoPeriodicLoops = 0;
m_disabledPeriodicLoops = 0;
m_telePeriodicLoops = 0;
printf("BuiltinDefaultCode Constructor Completed
");
}
//*Compressor
if (Joystick(1).GetRawButton(10)) //if button 10 is pressed on joystick 1 compressor will turn on
{
int compressor= new Compressor(1, 1);
compressor.Set(true);
}
if (Joystick(1).GetRawButton(11)) //if button 11 is pressed on joystick 1 compressor will turn off
{
compressor.Set(false);
}
// Solenoid
if (Joystick(1).GetRawButton(4)) //If button 4 is pressed on joystick 1 solenoid 1 will extrend
{
Solenoid(1).Set(true);
Solenoid(2).Set(false);
}
if (Joystick(2).GetRawButton(4)) //If button 4 is pressed on joystick 2 solenoid 1 will retract
{
Solenoid(1).Set(false);
Solenoid(2).Set(true);
}
if (Joystick(1).GetRawButton(5)) //If button 5 is pressed on joystick 1 solenoid 2 will extend
{
Solenoid(3).Set(true);
Solenoid(4).Set(false);
}
if (Joystick(2).GetRawButton(5)) //If button 5 is pressed on joystick 2 solenoid 2 will retract
{
Solenoid(3).Set(false);
Solenoid(4).Set(true);
}
if (Joystick(1).GetRawButton(2)) //If button 2 is pressed on joystick 1 solenoid 3(kicker) will extend
{
Solenoid(5).Set(true);
Solenoid(6).Set(false);
}
if (Joystick(2).GetRawButton(2)) //If button 2 is pressed on joystick 2 solenoid 3(kicker) will retrct
{
Solenoid(5).Set(false);
Solenoid(6).Set(true);
}
// Winch motor
Jaguar winchmotor(5); // Introduce Jaguar
if (Joystick(1).GetTrigger()) //If button is pressed
{
winchmotor.Set(0.5); //motor moves foward
}
if (Joystick(2).GetTrigger()) //If button is pressed
{
winchmotor.Set(-0.5
);
// motor moves backwards
}