View Single Post
  #1   Spotlight this post!  
Unread 02-13-2015, 01:19 PM
PredaFran PredaFran is offline
Amateur Programmer
AKA: Francisco
FRC #5285 (Sea Kings Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: California
Posts: 25
PredaFran is an unknown quantity at this point
Post Error in Tank Drive code

even tho the code seems ok, neither the 2 motors move, there is not a single problem with the joystick, or the rio, so it must be the code, any help is appreciated

Code:
#include "WPILib.h"
class Robot: public SampleRobot
{
	bool Piston;
	RobotDrive DriveRobot;
	Joystick leftStick;
	Joystick rightStick;
    Talon m_motor1;
	Talon m_motor2;
public:
	Robot() :

		    DriveRobot(1, 2),
  	        leftStick(0),
	        rightStick(1),
            m_motor1(1),
            m_motor2(2)

{
		DriveRobot.SetExpiration(0.1);
}


	void OperatorControl()
	{
		while (IsOperatorControl() && IsEnabled())
		{

			DriveRobot.TankDrive(leftStick, rightStick);
     		m_motor1.Set(leftStick.GetY());
			m_motor2.Set(rightStick.GetX());
			Wait(0.005);
		}
	}

};

START_ROBOT_CLASS(Robot);
Reply With Quote