summaryrefslogtreecommitdiff
path: root/tmk_core/tool/mbed/mbed-sdk/libraries/tests/mbed/i2c_mma7660/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/tool/mbed/mbed-sdk/libraries/tests/mbed/i2c_mma7660/main.cpp')
-rw-r--r--tmk_core/tool/mbed/mbed-sdk/libraries/tests/mbed/i2c_mma7660/main.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tmk_core/tool/mbed/mbed-sdk/libraries/tests/mbed/i2c_mma7660/main.cpp b/tmk_core/tool/mbed/mbed-sdk/libraries/tests/mbed/i2c_mma7660/main.cpp
new file mode 100644
index 0000000000..54b1687aa9
--- /dev/null
+++ b/tmk_core/tool/mbed/mbed-sdk/libraries/tests/mbed/i2c_mma7660/main.cpp
@@ -0,0 +1,26 @@
+#include "mbed.h"
+#include "test_env.h"
+#include "MMA7660.h"
+
+#if defined(TARGET_FF_ARDUINO)
+MMA7660 MMA(I2C_SDA, I2C_SCL);
+#else
+MMA7660 MMA(p28, p27);
+#endif
+
+int main() {
+ MBED_HOSTTEST_TIMEOUT(15);
+ MBED_HOSTTEST_SELECT(default_auto);
+ MBED_HOSTTEST_DESCRIPTION(I2C MMA7660 accelerometer);
+ MBED_HOSTTEST_START("MBED_A13");
+
+ if (!MMA.testConnection())
+ MBED_HOSTTEST_RESULT(false);
+
+ for(int i = 0; i < 5; i++) {
+ printf("x: %f, y: %f, z: %f\r\n", MMA.x(), MMA.y(), MMA.z());
+ wait(0.2);
+ }
+
+ MBED_HOSTTEST_RESULT(true);
+}