![]() |
Accelerometer Code Making Robot Stop Moving
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: Code:
class RobotDemo : public SimpleRobotCode:
public: |
Re: Accelerometer Code Making Robot Stop Moving
Quote:
If you only have one digital IO module in the cRIO, it will be module #1. Does the following code work better? Code:
adxl(1, 5, 6, 7, 8) |
Re: Accelerometer Code Making Robot Stop Moving
Quote:
X: 0 Y: 2 Z: 4 This is how we're getting the values: Code:
dsLCD->PrintfLine(DriverStationLCD::kUser_Line4, "Accelerometer X: %d", adxl.kAxis_X); |
Re: Accelerometer Code Making Robot Stop Moving
Apologies! We just edited our code to try and find values:
Code:
dsLCD->PrintfLine(DriverStationLCD::kUser_Line4, "X: %d", adxl.GetAcceleration(adxl.kAxis_X));X: 21360244 Y: 21360244 Z: 21360244 And the values never changed. Is there a "reset" for the accelerometer? Any ideas? |
Re: Accelerometer Code Making Robot Stop Moving
I thought %d was for integers. Doesn't the GetAcceleration() method return a float?
|
Re: Accelerometer Code Making Robot Stop Moving
in ADXL345_SPI.h, it says
Code:
virtual double GetAcceleration(Axes axis); |
Re: Accelerometer Code Making Robot Stop Moving
Quote:
%f is for floats %i is for integers but the accelerometer values return a double as Sushena pointed out. |
| All times are GMT -5. The time now is 13:03. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi