Contador de pasos

Dependencies:   MMA8451Q mbed

main.cpp

Committer:
gilbertogn
Date:
2016-02-14
Revision:
11:49b4472e155f
Parent:
1:aa7e037498b3

File content as of revision 11:49b4472e155f:


#include "mbed.h"
#include "MMA8451Q.h"

Serial serial1 (USBTX, USBRX);
MMA8451Q 

DigitalOut myled(LED1);

int main() {
    while(1) {
            acc.getAccAllAxis(data);  
        
        x= 1.0 - abs (data[0]* 0.03);
        y=1.0 - abs (data[1]* 0.03);
        z= 1.0 - abs (data[2]* 0.03);
        
        serial1.printf("%d",x); 
        serial1.printf(","); 
        serial1.printf("%d",y); 
        serial1.printf(",");
        serial1.printf("%d,\n",z);
        //serial1.printf(",");
        
        rled = 1.0 - abs(data[0]/16000.0);
        gled = 1.0 - abs(data[1]/16000.0);
        bled = 1.0 - abs(data[2]/16000.0);
         wait(0.4);
    }
        
}
hola