Gripper Control by Servo

Dependencies:   Servo mbed

Files at this revision

API Documentation at this revision

Comitter:
Mircea3M
Date:
Fri Jun 19 13:25:08 2015 +0000
Commit message:
Gripper controlled by Servo motor

Changed in this revision

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 cb6269b8bd21 Servo.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Servo.lib	Fri Jun 19 13:25:08 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/Servo/#36b69a7ced07
diff -r 000000000000 -r cb6269b8bd21 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jun 19 13:25:08 2015 +0000
@@ -0,0 +1,55 @@
+// ok
+// modificare culoare led in functie de forta
+#include "mbed.h"
+
+DigitalOut myled(LED1);
+
+// Continuously sweep the servo through it's full range
+#include "mbed.h"
+#include "Servo.h"
+
+Servo myservo(PTA13);
+AnalogIn Sensor(PTB3);
+DigitalOut red(LED1);
+DigitalOut green(LED3);
+DigitalOut blue(LED2);
+float forta = 0.0;
+
+int main()
+{
+
+
+    while(1) {
+        forta = Sensor.read();
+        if(forta < 0.2) {
+            red = 1;
+            green = 0;
+            blue = 0;
+            myservo = 0.2;
+        }
+        if(forta >= 0.2 && forta <= 0.5) {
+            red = 0;
+            blue = 0;
+            green = 1;
+            myservo = 0.4;
+        }
+        if(forta > 0.5) {
+            red = 0;
+            green = 0;
+            blue = 1;
+            myservo = 0.6;
+        }
+
+/*
+        for(int i=0; i<100; i++) {
+            myservo = i/100.0;
+            wait(0.01);
+        }
+        for(int i=100; i>0; i--) {
+            myservo = i/100.0;
+            wait(0.01);
+        }
+        */
+        wait(0.25);
+    }
+}
diff -r 000000000000 -r cb6269b8bd21 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Jun 19 13:25:08 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7cff1c4259d7
\ No newline at end of file