Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Double Solenoid Function Error (http://www.chiefdelphi.com/forums/showthread.php?t=144048)

TomorrowsGuru 02-17-2016 06:23 PM

Double Solenoid Function Error
 
We're trying to use several double solenoids in C++, but we keep getting an error. no matching function for call to
Code:

'DoubleSolenoid::DoubleSolenoid()'
Here's the code we're trying to use:
Code:

#include "WPILib.h"
class Robot: public SampleRobot {
Joystick driver;
DoubleSolenoid shootingArm;
DoubleSolenoid shifter;
DoubleSolenoid pusher;

const double kUpdatePeriod = 0.005;

// Numbers of the buttons to use for triggering the solenoids.
const int kSolenoidButton = 4;
const int kDoubleSolenoidForward = 2;
const int kDoubleSolenoidReverse = 3;

public:
Robot() :
        driver(0), // Use joystick on port 0.
        // Use double solenoid with Forward Channel of 1 and Reverse        of 2.
        shootingArm(1, 2)
{
}

void OperatorControl()
{
    while (IsOperatorControl() && IsEnabled())
    {
        if (driver.GetRawButton(kDoubleSolenoidForward))
            shootingArm.Set(DoubleSolenoid::kForward);
        else if (driver.GetRawButton(kDoubleSolenoidReverse))
            shootingArm.Set(DoubleSolenoid::kReverse);
        else
            shootingArm.Set(DoubleSolenoid::kOff);

        Wait(kUpdatePeriod);                // wait for a motor update time
    }
}
};

START_ROBOT_CLASS(Robot)

Any help would be appreciated.

SuperBK 02-17-2016 09:56 PM

Re: Double Solenoid Function Error
 
You need to add initializations for the pusher and shifter. Those are calls to the constructor of the class. 'DoubleSolenoid::DoubleSolenoid()

Code:

Robot() :
        driver(0), // Use joystick on port 0.
        // Use double solenoid with Forward Channel of 1 and Reverse of 2.
        shootingArm(1, 2),
                shifter(3,4),
                pusher(5,6)



All times are GMT -5. The time now is 09:17 AM.

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