christophe vermaelen
/
ER2_accelero_FRDM
Programme de base pour la machine à états sur l'accélomètre
main.cpp
- Committer:
- vermaelen
- Date:
- 2020-06-03
- Revision:
- 1:a1664788d34a
- Parent:
- 0:c188fa46ae96
File content as of revision 1:a1664788d34a:
#include "mbed.h" #include "MMA8451Q.h" #define I2C_ADDRESS (0x1d<<1) int main(void) { MMA8451Q acc(PTE25, PTE24, I2C_ADDRESS); float x, z; printf("MMA8451 ID: %d\n", acc.getWhoAmI()); while (1) { x = acc.getAccX(); z = acc.getAccZ(); printf("X: %1.2f, Z: %1.2f\r\n", x, z); wait(0.1); } }