A simple program that changes the brightness of the red led using the value of X-axis from MMA8451Q accelerometer.
main.cpp
- Committer:
- animesh44
- Date:
- 2018-06-27
- Revision:
- 0:274ec880d172
File content as of revision 0:274ec880d172:
#include "mbed.h" #include "MMA8451Q.h" #define MMA8451_I2C_ADDRESS(0X1d<<1) int main() { MMA8451Q acc(PTE25,PTE24,MMA8451_I2C_Address); PwmOut myled(LED1); while(1) { myled=1-abs(acc.getAccX()); wait(0.1); } }