A simple program that changes the brightness of the red led using the value of X-axis from MMA8451Q accelerometer.

Dependencies:   MMA8451Q mbed

Committer:
animesh44
Date:
Wed Jun 27 04:28:59 2018 +0000
Revision:
0:274ec880d172
A simple program that changes the brightness of the red led according to the value of X - axis from MMA8451Q accelerometer.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
animesh44 0:274ec880d172 1 #include "mbed.h"
animesh44 0:274ec880d172 2 #include "MMA8451Q.h"
animesh44 0:274ec880d172 3 #define MMA8451_I2C_ADDRESS(0X1d<<1)
animesh44 0:274ec880d172 4
animesh44 0:274ec880d172 5 int main() {
animesh44 0:274ec880d172 6 MMA8451Q acc(PTE25,PTE24,MMA8451_I2C_Address);
animesh44 0:274ec880d172 7 PwmOut myled(LED1);
animesh44 0:274ec880d172 8 while(1) {
animesh44 0:274ec880d172 9 myled=1-abs(acc.getAccX());
animesh44 0:274ec880d172 10 wait(0.1);
animesh44 0:274ec880d172 11 }
animesh44 0:274ec880d172 12 }