Olivia Itzel Solano
/
Contador_De_Pasos
Contador de pasos
solano.h
- Committer:
- OlySolano
- Date:
- 2016-02-15
- Revision:
- 12:a73fdd04a291
- Parent:
- 9:ff57931068f4
File content as of revision 12:a73fdd04a291:
#ifndef SOLANO #define SOLANO #include "mbed.h" #include "MMA8451Q.h" Serial serial1 (USBTX, USBRX); MMA8451Q acc(PTE25, PTE24); PwmOut rled(LED_RED); PwmOut gled(LED_GREEN); PwmOut bled(LED_BLUE); int16_t data [3]; int main() { serial1.baud(9600); serial1.format(8,SerialBase::None,1); serial1.putc(65); while(1) { acc.getAccAllAxis(data); //serial1.printf("%d\n",data[0]); //serial1.printf("%d\n",data[1]); serial1.printf("%d\n",data[2]); //rled = 1.0 - abs(data[0]/17000.0); //gled = 1.0 - abs(data[1]/17000.0); bled = 1.0 - abs(data[2]/17000.0); wait(0.4); pc.printf("pasos %d\n",cont); cont++; rled=0; //if(cont >'1'){ // cont++; //contt= cont1+cont; //pc.printf("paso %d\n",cont+cont1); //wait(1.0); //pc.printf("paso %d\n",contt); }else{ rled=1; } // if(-3500<data[2]&& data[2]>1000 ){ // cont1++; //contt=cont+cont1; //pc.printf("pasito%d\n",contt); // pc.printf("%d\n",cont1); // rled=0; // }else{ // rled=1; } //if(1000>data[2]&& data[2]<=-3500){ //data[2]=0; } } } #endif