Contador de pasos

Dependencies:   MMA8451Q mbed

Committer:
OlySolano
Date:
Fri Feb 12 13:57:04 2016 +0000
Revision:
9:ff57931068f4
Parent:
2:0feb4132c246
Child:
12:a73fdd04a291
actulizacion

Who changed what in which revision?

UserRevisionLine numberNew contents of line
OlySolano 2:0feb4132c246 1 #ifndef SOLANO
OlySolano 2:0feb4132c246 2 #define SOLANO
OlySolano 2:0feb4132c246 3 #include "mbed.h"
OlySolano 9:ff57931068f4 4 #include "MMA8451Q.h"
OlySolano 9:ff57931068f4 5
OlySolano 9:ff57931068f4 6 Serial serial1 (USBTX, USBRX);
OlySolano 9:ff57931068f4 7 MMA8451Q acc(PTE25, PTE24);
OlySolano 9:ff57931068f4 8 PwmOut rled(LED_RED);
OlySolano 9:ff57931068f4 9 PwmOut gled(LED_GREEN);
OlySolano 9:ff57931068f4 10 PwmOut bled(LED_BLUE);
OlySolano 9:ff57931068f4 11 int16_t data [3];
OlySolano 9:ff57931068f4 12
OlySolano 9:ff57931068f4 13 int main() {
OlySolano 9:ff57931068f4 14 serial1.baud(9600);
OlySolano 9:ff57931068f4 15 serial1.format(8,SerialBase::None,1);
OlySolano 9:ff57931068f4 16 serial1.putc(65);
OlySolano 9:ff57931068f4 17
OlySolano 9:ff57931068f4 18 while(1) {
OlySolano 9:ff57931068f4 19 acc.getAccAllAxis(data);
OlySolano 9:ff57931068f4 20
OlySolano 9:ff57931068f4 21 //serial1.printf("%d\n",data[0]);
OlySolano 9:ff57931068f4 22 //serial1.printf("%d\n",data[1]);
OlySolano 9:ff57931068f4 23 serial1.printf("%d\n",data[2]);
OlySolano 9:ff57931068f4 24
OlySolano 9:ff57931068f4 25 //rled = 1.0 - abs(data[0]/17000.0);
OlySolano 9:ff57931068f4 26 //gled = 1.0 - abs(data[1]/17000.0);
OlySolano 9:ff57931068f4 27 bled = 1.0 - abs(data[2]/17000.0);
OlySolano 9:ff57931068f4 28 wait(0.4);
OlySolano 9:ff57931068f4 29 }
OlySolano 9:ff57931068f4 30 }
OlySolano 9:ff57931068f4 31
OlySolano 9:ff57931068f4 32
OlySolano 2:0feb4132c246 33
OlySolano 2:0feb4132c246 34
OlySolano 2:0feb4132c246 35
OlySolano 2:0feb4132c246 36 #endif