Module 2 ECEN 5803 Project 1 Submitted by 1. Rahul Yamasani 2. Srivishnuj Alvakonda

Dependencies:   MMA8451Q TSI mbed

Fork of FRDM_MMA8451Q by mbed official

Committer:
emilmont
Date:
Tue Oct 23 09:25:15 2012 +0000
Revision:
5:bf5becf7469c
Parent:
4:367de1084ea9
Child:
8:3246b1db17ce
Update mbed library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chris 2:41db78380a6e 1 #include "mbed.h"
chris 2:41db78380a6e 2 #include "MMA8451Q.h"
chris 2:41db78380a6e 3
chris 2:41db78380a6e 4 #define MMA8451_I2C_ADDRESS (0x1d<<1)
chris 2:41db78380a6e 5
chris 4:367de1084ea9 6 int main(void) {
emilmont 5:bf5becf7469c 7 MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);
emilmont 5:bf5becf7469c 8 PwmOut rled(LED_RED);
emilmont 5:bf5becf7469c 9 PwmOut gled(LED_GREEN);
emilmont 5:bf5becf7469c 10 PwmOut bled(LED_BLUE);
chris 4:367de1084ea9 11
emilmont 5:bf5becf7469c 12 while (true) {
chris 3:f2d3e041d8f2 13 rled = 1.0 - abs(acc.getAccX());
chris 3:f2d3e041d8f2 14 gled = 1.0 - abs(acc.getAccY());
chris 3:f2d3e041d8f2 15 bled = 1.0 - abs(acc.getAccZ());
chris 3:f2d3e041d8f2 16 wait(0.1);
chris 2:41db78380a6e 17 }
chris 2:41db78380a6e 18 }