J Daniel Martinez C
/
SensoresUltrasonicosSRF05
Upaep
Revision 0:92ceb941f65e, committed 2013-10-21
- Comitter:
- dan_cuspi
- Date:
- Mon Oct 21 16:03:20 2013 +0000
- Commit message:
- Sensor Ultrasonico SRF015
Changed in this revision
diff -r 000000000000 -r 92ceb941f65e SRF05.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SRF05.lib Mon Oct 21 16:03:20 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/SRF05/#e758665e072c
diff -r 000000000000 -r 92ceb941f65e main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Oct 21 16:03:20 2013 +0000 @@ -0,0 +1,49 @@ +#include "mbed.h" + +#include "mbed.h" +#include "SRF05.h" + // Trigger Echo +SRF05 srfIzquierdo(p11, p12); +SRF05 srf2Derecho(p13, p14); +SRF05 srf3Frontal(p15, p16); + + +//motor Izquierdo , atras y adelante +DigitalOut FernandoAdI(LED1); +DigitalOut FernandoAtI(LED2); +//motor derecho , atras y adelante +DigitalOut FernandoAdD(LED3); +DigitalOut FernandoAtD(LED4); + +int main() { + while(1) { + printf("Distance = %.1f %.1f %.1f \n\r", srfIzquierdo.read(),srf2Derecho.read(),srf3Frontal.read()); + FernandoAdI=0; + FernandoAtI=0; + FernandoAdD=0; + FernandoAtD=0; + + // Sensor Izquierdo + if (srfIzquierdo.read()>15)//distancia de sensro mayor a 15 + { + //motor Izquierdo + FernandoAdI=1; //input 1 + FernandoAtI=0; //intput2 + //motor Derecho + FernandoAdD=1; //input3 + FernandoAtD=0; //input 4 + } + else + { + FernandoAdI=0; + FernandoAtI=1; + FernandoAdD=0; + FernandoAtD=1; + } + + + } + + // wait(0.2); + } + \ No newline at end of file
diff -r 000000000000 -r 92ceb941f65e mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Oct 21 16:03:20 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file