Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 22:29e613c92a2c, committed 2016-02-18
- Comitter:
- DiegoRivera
- Date:
- Thu Feb 18 01:37:35 2016 +0000
- Parent:
- 21:126249da7210
- Commit message:
- final
Changed in this revision
--- a/Diego.h Fri Feb 12 14:37:20 2016 +0000 +++ b/Diego.h Thu Feb 18 01:37:35 2016 +0000 @@ -3,14 +3,15 @@ #include "mbed.h" -DigitalOut rojo(LED_RED); -DigitalOut azul(LED_BLUE); + void Diego_Choque(int dataX, int dataY) { + DigitalOut rojo(LED_RED); + DigitalOut azul(LED_BLUE); rojo=1; azul=1; - if(abs(dataX)>32000 && abs(dataY)>32000) + if(abs(dataX)>25000 && abs(dataY)>25000) { azul=0; while(1)
--- a/cruz.h Fri Feb 12 14:37:20 2016 +0000 +++ b/cruz.h Thu Feb 18 01:37:35 2016 +0000 @@ -2,18 +2,18 @@ #define CRUZ #include "mbed.h" -void cruz_choqueY(int dataY){ +void cruz_choqueY(int dataY) +{ DigitalOut azul(LED_BLUE); azul=1; - if(abs(dataY)>32000){ + if(abs(dataY)>32000) + { azul=0; while(1) - { + { azul=!azul; - rojo=!rojo; - } - - + } } - #endif \ No newline at end of file +} +#endif \ No newline at end of file
--- a/detectorimpacto.hh Fri Feb 12 14:37:20 2016 +0000 +++ b/detectorimpacto.hh Thu Feb 18 01:37:35 2016 +0000 @@ -1,27 +1,22 @@ #ifndef detectorimpacto #define detectorimpacto -#include " mbed.h" - - DigitalOut rojo(LED_RED); -void detectorimpacto_choqueX(int dataX){ +#include "mbed.h" + +void detectorimpacto_choqueX(int dataX) +{ + DigitalOut rojo(LED_RED); - - rojo=1; - if(abs(dataX)>28000){ + rojo=1; + if(abs(dataX)>32000) + { rojo=0; - while(1) - { - + while(1) + { rojo=!rojo; - wait(.5); - } - - - - - - + wait(.1); + } + } } #endif \ No newline at end of file
--- a/main.cpp Fri Feb 12 14:37:20 2016 +0000 +++ b/main.cpp Thu Feb 18 01:37:35 2016 +0000 @@ -1,6 +1,8 @@ #include "mbed.h" #include "MMA8451Q.h" #include "Diego.h" +#include "detectorimpacto.hh" +#include "cruz.h" //Serial s0(USBTX, USBRX); MMA8451Q acc(PTE25, PTE24); @@ -20,6 +22,8 @@ { acc.getAccAllAxis(data); // s0.printf("%d,\t%d,\t%d\n", data[0], data[1], data[2]);// + detectorimpacto_choqueX(data[0]); + cruz_choqueY(data[1]); Diego_Choque(data[0], data[1]); } }