Quote:
Originally Posted by Bryscus
P.S.S.S. Here's an example of what my code would be using CAN over the serial port.
Code:
#include "WPILib.h"
#include "CANJaguar.h"
class Spy : public SimpleRobot
{
CANJaguar *mtr;
public:
Spy(void)
{
mtr = new CANJaguar (5); //or whatever ID you have set
GetWatchdog().SetEnabled(false);
}
void Autonomous(void)
{
}
void OperatorControl(void)
{
while (true) {
mtr->Set(0.5);
Wait(0.5);
}
}
};
START_ROBOT_CLASS(Spy);
|
And because of the unified architecture, the exact same code will work with the 2CAN with no modifications (or even rebuilding) by simply changing which driver plugin is configured to load on startup. It may be good to get a baseline with serial so you know the robot code is OK, then switch to the 2CAN plugin and see if there might be a problem with it.
-Joe