![]() |
Programming acc/gyro
This is our first time using this sensor.....
What would be the simplest way to program for the following: We just need to tell if we are leaning side to side on 1 axis. |
Re: Programming acc/gyro
I suggest you look at the ADXL345 I2C Accelerometer example project to get started.
To measure your tilt, read the horizontal (either X or Y) and vertical (Z) acceleration axes and feed them into a rectangular-to-polar coordinate conversion function. The angle output will tell you which direction is "up" according to gravity. |
Re: Programming acc/gyro
Here is a follow-up question.
The WPI accelerometer icons found in LabVIEW under the WPI library is for an analog accelerometer (example under analog section of FRC examples). Is that using the gyroscope used as an accelerometer? If so, how is it wired? The A..345 accelerometer is a digital device. The example for the A..345 worked for me, but I'm not clear about how to bring the driver code for that into the project. I'm not sure if I need to pursue wiring an analog accelerometer to use the LabVIEW stuff that is readily available, or if I should stick the A...345 digital accelerometer and figure out how to import the drivers into the project. Thank you, Tim |
Re: Programming acc/gyro
Quote:
Quote:
Now you can copy the functions you want to use from the newly added ADXL345 I2C Accelerometer.vi into Begin, Teleop, Periodic Tasks, Finish, etc. Once you've placed them where you want them, you should remove ADXL345 I2C Accelerometer.vi from your project by right-clicking it and choosing Remove from Project. You can also drag a vi from the Drivers folder into any vi you want to use it in, or use the Select a VI... option from the functions menu to find and place them. |
| All times are GMT -5. The time now is 12:10. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi