Hey, apologies if this is an already answered question. I couldn’t find anything on the topic.
The problem that we’re having is whenever we state the accelerometer (not even doing anything with it, but just instantiating it), our robot components stop working completely. The robot won’t move, et cetera.
Also, we don’t know how to get the values from the gyro once in teleop, or rather the method to use to get the values from the accelerometer.
This is our code:
class RobotDemo : public SimpleRobot
{
RobotDrive myRobot; // robot drive system
Joystick stick1, stick2; // only joystick
ADXL345_SPI adxl;
public:
RobotDemo(void):
myRobot(2, 1), // these must be initialized in the same order
stick1(1), // as they are declared above.
stick2(2),
adxl(5, 6, 7, 8, ADXL345_SPI::kRange_2G)
The constructor for ADXL345_SPI takes the digital IO module as the first parameter and has a default kRange_2G value for the 6th parameter. You are asking it to use a non-existant module 5 which probably causes the robot code to crash. Do you see an error message about using a module out of range?
If you only have one digital IO module in the cRIO, it will be module 1.