Movimiento de Motor DC y Servo

Dependencies:   Motor Servo mbed

Files at this revision

API Documentation at this revision

Comitter:
DnPlas
Date:
Sat Oct 11 20:49:52 2014 +0000
Commit message:
Programa control de Motor a DC y Servo

Changed in this revision

Motor.lib Show annotated file Show diff for this revision Revisions of this file
Servo.lib Show annotated file Show diff for this revision Revisions of this file
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 996a30882975 Motor.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Motor.lib	Sat Oct 11 20:49:52 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/Motor/#f265e441bcd9
diff -r 000000000000 -r 996a30882975 Servo.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Servo.lib	Sat Oct 11 20:49:52 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/Servo/#36b69a7ced07
diff -r 000000000000 -r 996a30882975 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Oct 11 20:49:52 2014 +0000
@@ -0,0 +1,35 @@
+/*Borrador 1: realizar un recorrido formando un cuadrado. Las vueltas se harán cada cierto tiempo.
+11 de octubre de 2014 - Daniela Plascencia */
+//--------LIBRARIES--------
+#include "mbed.h"
+#include "Servo.h"
+#include "Motor.h"
+//--------I/O PINS-------
+DigitalOut myled(LED1);
+PwmOut servo(PTD4);
+Motor motor(D3, D8, D9);
+Timer timer;
+//------VARIABLES-------
+float i = 0.0;
+//-------MAIN PROGRAM------
+int main ()
+{
+    timer.start();
+    do {
+        float tiempo = timer.read();
+        if(tiempo <= 5) {
+            motor.speed(1.0);
+        } else {
+            if(i<=2.0) {
+                i+= 1.0;
+                motor.speed(0.5);
+                servo.write(0.075);
+                wait(0.2);
+                servo.write(0.0);
+                wait(0.2);
+                timer.reset();
+            }
+        }
+    } while(i<=3.0);
+    timer.stop();
+}
\ No newline at end of file
diff -r 000000000000 -r 996a30882975 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Oct 11 20:49:52 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file