Olivia Itzel Solano
/
Contador_De_Pasos
Contador de pasos
Revision 12:a73fdd04a291, committed 2016-02-15
- Comitter:
- OlySolano
- Date:
- Mon Feb 15 00:39:58 2016 +0000
- Parent:
- 10:5b9057acf106
- Commit message:
- Al parecer ya quedo
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
solano.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Feb 13 01:40:47 2016 +0000 +++ b/main.cpp Mon Feb 15 00:39:58 2016 +0000 @@ -3,11 +3,12 @@ Serial pc (USBTX, USBRX); MMA8451Q acc(PTE25, PTE24); -PwmOut rled(LED_RED); -PwmOut gled(LED_GREEN); -PwmOut bled(LED_BLUE); +DigitalOut gled(LED2); +DigitalOut rled(LED1); + int16_t data [3]; -int cont1,cont,z; +int cont1=1,cont=1,z, contt; + int main() { pc.baud(9600); @@ -19,20 +20,21 @@ // serial1.printf("%d\n",data[0]); // serial1.printf("%d\n",data[1]); - pc.printf("%d\n",data[2]); + // pc.printf("%d\n",data[2]); // rled1.0 - abs(data[0]/10.0); // gled = 1.0 - abs(data[1]/17000.0); z= 1.0 - abs(data[2]/10.0); wait(0.4); - if(-4000>data[2]){ - cont1++; - pc.printf("%d\n",cont1); - if(-4000<data[2]) - pc.printf("%d\n",0); - //}else{ - // cont=0; - - }}} + if(-2000> data[2]){ + pc.printf("pasos %d\n",cont); + cont++; + rled=0; + }else{ + rled=1; + } + + } +
--- a/solano.h Sat Feb 13 01:40:47 2016 +0000 +++ b/solano.h Mon Feb 15 00:39:58 2016 +0000 @@ -26,7 +26,35 @@ //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; + + } + } + }