Victor ArmMotor = new Victor(7);
It supposed to be the exact same thing, without the pointer(*) and doing the initialization the same time the ArmMotor object is defined. If it doesn't work, then I'll have to look further into this to see why.
Actually, the code to declare a local variable is:
Code:
Victor ArmMotor(7);
If you wanted to use local/member variables in a class, you can initialize them at the beginning of your constructor, like:
Code:
class HOT_Bot : public IterativeRobot
{
// Declare robot drive system variable
RobotDrive myRobot; // robot will use PWM 1-4 for drive motors
// Declare driver station object variable
DriverStation *ds; // driver station object
TrackingThreshold tdata; // image data for tracking
// Declare GamePad variables
GamePad gamePad1; // gamepad 1 (drive control)
GamePad gamePad2; // gamepad 2 (arm control)
// Declare drive motor variables
// PWM 1 and 2 are unused, we'll save them for a four-motor drivetrain
Victor leftDriveMotor; // left drive motor will be on PWM 3
Victor rightDriveMotor; // right drive motor will be on PWM 4
......
HOT_Bot(void)
: myRobot(1,2,3,4),
gamePad1(1),
gamePad2(2),
leftDriveMotor(3),
rightDriveMotor(4),
......
{
PRINTFDEBUG(("HotBot Constructor Started\n"));
// Acquire the Driver Station object
ds = DriverStation::GetInstance();
......
Please note, these changes aren't necessary and the method given here works well enough. I would recommend them though, because this will speed up the loading of the code by a very small amount, and simplify the constructor.
Thanks,
Sam