|
Re: Pointers and Tank Drive?
well, in my experience with the C++ for the cRIO with WPILib.h,
in the definition for your robot class, you need to have something like this:
Joystick* leftStick;
Joystick* rightStick; //the *'s mean they're a pointer.
RobotDrive* myRobot;
Then in the constructor, you need to have something like:
leftStick = new Joystick(1); //joystick in DS port 1
rightStick = new Joystick(2); //DS port 2
myRobot = new RobotDrive(1,2,3,4); //4 motor drive, with the motors connected to PWM1,2,3,4, on sidecar 1.
and then in the operator control bit, you need something like:
myRobot->TankDrive(leftStick, rightStick);
|