Proyecto Nivel, Edgar Ochoa, Erik Garcia

Dependencies:   MMA8451Q mbed

main.cpp

Committer:
through
Date:
2016-02-12
Revision:
22:de1ab79df237
Parent:
10:76ab6531ba6f
Child:
25:2d2f8736f147
Child:
26:e10b8fb4e2ae

File content as of revision 22:de1ab79df237:

#include "adcBasic.h"
#include "mbed.h"
#include "MMA8451Q.h"
MMA8451Q acc(PTE25, PTE24);
PwmOut r(LED_RED);
PwmOut g(LED_GREEN);
PwmOut b(LED_BLUE);
Serial pc(USBTX,USBRX);
float x,y,z;



int16_t data[3];
int main() {
    
    pc.baud(9600); //velocidad serial//
    pc.format(8,SerialBase::None ,1) ;
    pc.putc(65);
    mensaje();
    while(1) {
        
        acc.getAccAllAxis(data);       
    
        z = 1.0 - abs(data[0]/16500.0);
        y = 1.0 - abs(data[1]/16500.0);
        x = 1.0 - abs(data[2]/16500.0);
        
    
        pc.printf("%d,%d,%d,\n",data[0],data[1],data[2]);
        
        wait(0.4);
        
     }
        
    }


//Hola Mundo!!! jajajaja
//otro cambio