Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MAG3110 MMA8491 MMA8491Q MPL3115 MPL3115A2 mbed
Revision 2:22c3ec6319ce, committed 2017-09-14
- Comitter:
- seanburford
- Date:
- Thu Sep 14 20:39:22 2017 +1000
- Parent:
- 1:ecfba4d67833
- Commit message:
- Switch to NXP library for accel.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Sep 14 06:59:30 2017 +0000
+++ b/main.cpp Thu Sep 14 20:39:22 2017 +1000
@@ -10,12 +10,14 @@
int main()
{
- MMA8491Q acc(PTE0, PTE1, MMA8491_I2C_ADDRESS);
+ MMA8491 acc(I2C_SDA, I2C_SCL, PTA13);
while (true) {
- rled = 1.0 - abs(acc.getAccX());
- gled = 1.0 - abs(acc.getAccY());
- bled = 1.0 - abs(acc.getAccZ());
+ float data[3];
+ acc.acquire_MMA8491_data_g(data);
+ rled = 1.0 - abs((long)data[0]);
+ gled = 1.0 - abs((long)data[1]);
+ bled = 1.0 - abs((long)data[2]);
wait(0.1);
}
@@ -27,4 +29,4 @@
// wait (0.0025f);
// }
//}
-}
\ No newline at end of file
+}