Our spike is not giving power to our motor. This is my code:
Code:
#include "WPILib.h"
/**
* This is a demo program showing the use of the RobotBase class.
* The SimpleRobot class is the base of a robot application that will automatically call your
* Autonomous and OperatorControl methods at the right time as controlled by the switches on
* the driver station or the field controls.
*/
class RobotDemo : public SimpleRobot
{
RobotDrive myRobot; // robot drive system
Joystick stickL; // LEFT joystick
Joystick stickR; // RIGHT joystick
Jaguar ballSucker; // Central ball aquiring mechanism
Relay door; // Ball release mechanism
public:
RobotDemo(void):
myRobot(2, 1), // these must be initialized in the same order
stickL(1), // as they are declared above.
stickR(2),
ballSucker(3),
door(4)
{
GetWatchdog().SetExpiration(0.1);
}
/**
* Drive left & right motors for 2 seconds then stop
*/
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
}
/**
* Runs the motors with arcade steering.
*/
void OperatorControl(void)
{
GetWatchdog().SetEnabled(true);
while (IsOperatorControl())
{
GetWatchdog().Feed();
myRobot.TankDrive(stickR, stickL); // drive with tank style
if (stickL.GetTrigger()) // If Left Joystick Trigger is HELD
ballSucker.Set(-1.0);
else // If Left Joystick Trigger is RELEASED
ballSucker.Set(0.0);
if (stickR.GetTrigger()) // If Right Joystick Trigger is HELD
door.Set(Relay::kForward);
else // If Right Joystick Trigger is RELEASED
door.Set(Relay::kOff);
Wait(0.005); // wait for a motor update time
}
}
};
START_ROBOT_CLASS(RobotDemo);
The Jaguar for 'ballSucker' works fine, I changed it from the left trigger to the right trigger to make sure both triggers were working properly. Are we setting up the Relay wrong?
It might be a wiring problem, also. We were not sure where to plug in the spike's PWM cable on the digital sidecar. Right now it is plugged in to Relay port 4, but we have also tried the side for the Jaguars and it did not work. We tried turning the cables around, too.
Thanks,
-Team 1358