sparkfun / mma8452_accelerometer Goto Github PK
View Code? Open in Web Editor NEWTriple axis accelerometer MMA8452, I2C based with tap and orientation settings.
Home Page: https://www.sparkfun.com/products/10955
License: Other
Triple axis accelerometer MMA8452, I2C based with tap and orientation settings.
Home Page: https://www.sparkfun.com/products/10955
License: Other
I am trying to run the Advanced code on a different Arduino that only had pins A0-A3. How would i change the code to adapt the accelerometer advanced sample code to an Arduino without A4/A5 pins?
For some reason when using this accelerometer with a Leonardo the Leonardo hangs after a few seconds. I tried it with an Uno and it was fine. As a solution I got rid of Wire.h library and used this library instead: http://github.com/DSSCircuits/I2C-Master-Library. Works great now.
should be ctrl &= 0xC7;
ODR takes 3 bytes :)
I´m using two accelerometers for a project but when using with ODR over 50 it keeps hanging after a few seconds operating. Apparently it is losing some data because just after checking the available() it freezes inside the read(). I tried to replace the WIRE library for the I2C I founded on another issue thread and it seems to be working now. Is this approach correct?
Hey there, I am just experiencing issues to initialize (or to change) the sampling frequency. I thought the default value is 800Hz, but the data I collected using Arduino is way less than 800Hz, its more like 20Hz something. Can someone help me with how to adjust the sampling frequency?
It won't post any data on Teensy 2.0. (It does post data with Teensy 3.0)
In two places in SparkFun_MMA8452Q.cpp, there is a while-loop after the Wire.requestFrom() call. That while-loop is not needed.
When the Wire.requestFrom() function returns, the I2C transaction has completely finished and the received data is in the receive buffer in the Wire library. The Wire.read() only reads data from that buffer.
When there was a I2C bus error or I2C collision, there would be less bytes received, and that while-loop would halt the sketch.
Running on Teensy 3.0
Something seems to be wrong in the Basic Example lines 86,87
When changing signs, the number suddenly turns huge. I fixed this by replacing tines 86,87 with:
gCount -= 4096;//not sure if this needs a +1 or not...
This is probably due to teensy3.0 using 32bit integers.
The x, y, and z values as read from the MMA come as 2's complement 12-bit numbers, and are assigned directly to integers. At least on 32-bit systems (Teensy) this doesn't work correctly for negative G-values and they need to be converted into signed values.
One fix is to add the following lines after the assignment of x,y and z and before cx/cy/cz:
// Convert the 2's complement 12-bit values to signed integers.
x = (x >> 11) == 0 ? x : -1 ^ 0xFFF | x;
y = (y >> 11) == 0 ? y : -1 ^ 0xFFF | y;
z = (z >> 11) == 0 ? z : -1 ^ 0xFFF | z;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.