el prollecto trata del detector de las vibraciones de un motor alejandro mejia garcia jorge arturo juarez ornelas
main.cpp
- Committer:
- Jamg
- Date:
- 2016-02-10
- Revision:
- 3:520a628eda11
- Parent:
- 1:72d82b176149
- Child:
- 4:b4ff62c91888
File content as of revision 3:520a628eda11:
#include "mbed.h" #include "MMA8451Q.h" MMA8451Q acc(PTE25, PTE24); PwmOut rled(LED_RED); PwmOut gled(LED_GREEN); PwmOut bled(LED_BLUE); int16_t dato[3]; int16_t x = 0; int16_t y = 0; //hola hola int16_t z = 0; int main() { while(1) { //temblor acc.getAccAllAxis(dato); x = dato[0] * 0.03; y = dato[1] * 0.03; z = dato[2] * 0.03; // gir.printf("%d",dato[0]); //gir.printf(","); // gir.printf("%d",dato[1]); // gir.printf(","); //gir.printf("%d,\n",dato[2]); // gir.printf(","); // rled = 1.0 - abs(dato[0]/16000.0); // gled = 1.0 - abs(dato[1]/16000.0); //bled = 1.0 - abs (dato[2]/16000.0); // wait(.3); if(dato[1]>=900){ bled=1; rled=0; //alar=1; //pc.printf("* TEMBLOR"); wait(.5); rled=1; }else{ bled=1; gled=0; // alar=0; //pc.printf("* SEGURO"); wait(.5); gled=1; } } }