servo Helloworld

Dependencies:   Servo_Test mbed Motor

Files at this revision

API Documentation at this revision

Comitter:
Joshua23
Date:
Mon Nov 14 12:55:25 2016 +0000
Parent:
0:ac3026899cce
Commit message:
Test launcher

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Motor.lib	Mon Nov 14 12:55:25 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/aberk/code/Motor/#c75b234558af
--- a/Servo.lib	Sat Oct 29 13:48:08 2016 +0000
+++ b/Servo.lib	Mon Nov 14 12:55:25 2016 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/Joshua23/code/Servo_Test/#9a4d45c26311
+https://developer.mbed.org/users/Joshua23/code/Servo_Test/#0e5a56409396
--- a/main.cpp	Sat Oct 29 13:48:08 2016 +0000
+++ b/main.cpp	Mon Nov 14 12:55:25 2016 +0000
@@ -1,22 +1,31 @@
 // Continuously sweep the servo through it's full range
 #include "mbed.h"
 #include "Servo.h"
+#include "Motor.h"
 
-Servo myservo(PC_8);
+Servo myservo(PC_6);
+DigitalIn mybut(USER_BUTTON);
+Serial pc (USBTX,USBRX);
+Motor motor1(PA_8,PC_15,PB_0);
+Motor motor2(PA_11,PA_5,PA_6);
 
 int main() {
-    wait_ms(100);
-    myservo.position(-90);
-    wait_ms(2000);
-    while(1) {
-        for(int i=-90; i<=90; i++) {
-            myservo.position(i);
-            wait(0.01);
-        }
-        for(int i=90; i>-90; i--) {
-            myservo.position(i);
-            wait(0.01);
+    pc.baud(9600);
+    while(1){
+        motor1.speed(-0.6);
+        motor2.speed(0.96);
+        myservo.position(-60);
+        //pc.printf("My But : %.d \n",mybut);
+        while(mybut==0) {
+            
+            for(int i=-90; i<=-60; i++) {
+                myservo.position(i);
+                wait(0.025);
+            }
+            for(int i=-60; i>-90; i--) {
+                myservo.position(i);
+                wait(0.005);
+            }
         }
     }
-   
 }
--- a/mbed.bld	Sat Oct 29 13:48:08 2016 +0000
+++ b/mbed.bld	Mon Nov 14 12:55:25 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/9bcdf88f62b0
\ No newline at end of file