View Full Version : Accelerometer
ElliotCourant
31-01-2011, 19:49
So I'm trying to implement the accelerometer, and i get several errors.
RobotDemo(void):
myRobot(1, 2, 3, 4), // these must be initialized in the same order
leftstick(1), // as they are declared above.
rightstick(2), // as they are declared above.
gyro(1,1),
acc(I2C)
{
and it gives me this
C:/WindRiver/workspace/Final/MyRobot.cpp:34: error: expected primary-expression before ')' token
How do I implement the accelerometer?
ElliotCourant
31-01-2011, 20:17
bump
Alan Anderson
31-01-2011, 22:11
Be patient. It was less than a half hour before your "bump".
Have you looked at the documentation for the ADXL345_I2C class? Is there anything you don't understand about it?
basicxman
01-02-2011, 14:42
So I'm trying to implement the accelerometer, and i get several errors.
RobotDemo(void):
myRobot(1, 2, 3, 4), // these must be initialized in the same order
leftstick(1), // as they are declared above.
rightstick(2), // as they are declared above.
gyro(1,1),
acc(I2C)
{
and it gives me this
C:/WindRiver/workspace/Final/MyRobot.cpp:34: error: expected primary-expression before ')' token
How do I implement the accelerometer?
Which line is 34? What is I2C? A constant? A macro? Full source code would be helpful.
ElliotCourant
01-02-2011, 18:03
Which line is 34? What is I2C? A constant? A macro? Full source code would be helpful.
line 34 is "acc(I2C)"
9918 That is a screenshot of just that part.
And yes I have looked at the documentation but it didn't really help me that much. It just told me that it needed a slot and a PID source. But because the accelerometer is connected to the I2C section I can't get it to work.
ElliotCourant
01-02-2011, 18:28
Here is the deceleration of "acc"
9919
But it doesn't give me any errors there
basicxman
01-02-2011, 21:58
Here is the deceleration of "acc"
9919
But it doesn't give me any errors there
Are you using the ADXL345? In which case you need to use the ADXL345_I2C class, not the Accelerometer class.
Again, what is I2C? A macro? A constant?
Alan Anderson
01-02-2011, 22:10
Are you using the ADXL345? In which case you need to use the ADXL345_I2C class, not the Accelerometer class.
Quite correct.
Again, what is I2C? A macro? A constant?
In the code Elliot posted, I2C is undefined. That's why the compiler choked on it.
basicxman
01-02-2011, 22:12
In the code Elliot posted, I2C is undefined. That's why the compiler choked on it.
Elliot did not post his entire source code, there could be a constant or preprocessor definition above the class definition.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.