Control de estacionamiento por medio de funciones.

Dependencies:   mbed

Fork of asd by Jasiel Alejandro Moreno Reyes

1 microcontrolador Mbed LPC1768, cortex-M3, 96MHz, 512KB Flash, 32KB RAM 1 driver puente h L298N 2 motorreductores con ruedas jumpers 1 rueda loca

Files at this revision

API Documentation at this revision

Comitter:
jasalex98
Date:
Mon Feb 18 16:26:11 2019 +0000
Commit message:
Version 0.1

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 6d370baca3cf main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Feb 18 16:26:11 2019 +0000
@@ -0,0 +1,72 @@
+#include "mbed.h"
+float a=2.5;
+float b=0.5;
+float x=0.4;
+float y=0.75;
+float z=0.3;
+
+void avanza(float);
+void espera(float);
+void ireversa(float);
+void reversa(float);
+void derecha(float);
+
+DigitalOut pin1(p21);
+DigitalOut pin2(p22);
+DigitalOut pin3(p23);
+DigitalOut pin4(p24);
+
+int main() {
+    while(1) {
+        avanza(2.5);
+        espera(0.5);
+        ireversa(0.4);
+        espera(0.5);
+        reversa(0.75);
+        espera(0.5);
+        derecha(0.3);
+        espera(0.5);
+        avanza(2.5);
+    while(1) {
+        pin1 = 0;
+        pin2 = 0;
+        pin3 = 0;
+        pin4 = 0;
+    }
+    }
+    }
+    void avanza(float a){
+        pin1 = 1;
+        pin2 = 0;
+        pin3 = 1;
+        pin4 = 0;
+        wait(a);
+        }
+    void espera(float b){
+        pin1 = 0;
+        pin2 = 0;
+        pin3 = 0;
+        pin4 = 0;
+        wait(b);
+        }
+    void ireversa(float x){
+        pin1 = 1;
+        pin2 = 0;
+        pin3 = 0;
+        pin4 = 0;
+        wait(x);
+        }
+    void reversa(float y){
+        pin1 = 0;
+        pin2 = 1;
+        pin3 = 0;
+        pin4 = 1;
+        wait(y);
+        }
+    void derecha(float z){
+        pin1 = 0;
+        pin2 = 0;
+        pin3 = 1;
+        pin4 = 0;
+        wait(z);
+        }
\ No newline at end of file
diff -r 000000000000 -r 6d370baca3cf mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Feb 18 16:26:11 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/3a7713b1edbc
\ No newline at end of file