zhaw_st16b_pes2_10 / Mbed 2 deprecated Greifer

Dependencies:   Servo mbed

Fork of Greifer by Giona V

Files at this revision

API Documentation at this revision

Comitter:
EpicG10
Date:
Thu May 04 19:10:52 2017 +0000
Parent:
0:aace975d101e
Commit message:
h

Changed in this revision

Greifer.cpp Show annotated file Show diff for this revision Revisions of this file
Greifer.h 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
--- a/Greifer.cpp	Fri Mar 24 15:36:19 2017 +0000
+++ b/Greifer.cpp	Thu May 04 19:10:52 2017 +0000
@@ -8,21 +8,27 @@
 
 Greifer::Greifer()
 {
-    init();  
+    //init();  
 }
 
 void Greifer::init()
 {
     ServoGreifer.calibrate(0.0017f, 180.0f);
-    ServoGreifer.position(-30.0f);
+    ServoGreifer.position(60.0f);
 }
 
-void Greifer::take()
+int Greifer::leave()
 {
-    ServoGreifer.position(90.0f);
+    ServoGreifer.position(60.0f);
+    t=0;
+    l=1;
+    return l;
 }
 
-void Greifer::leave()
+int Greifer::take()
 {
-    ServoGreifer.position(-30.0f);
+    ServoGreifer.position(-150.0f);
+    t=1;
+    l=0;
+    return t;
 }
\ No newline at end of file
--- a/Greifer.h	Fri Mar 24 15:36:19 2017 +0000
+++ b/Greifer.h	Thu May 04 19:10:52 2017 +0000
@@ -16,10 +16,11 @@
         Greifer();
         
         void init();
-        void take();
-        void leave();
+        int take();
+        int leave();
         
-
+ private:
+        int t,l;
 };
 
 #endif
--- a/main.cpp	Fri Mar 24 15:36:19 2017 +0000
+++ b/main.cpp	Thu May 04 19:10:52 2017 +0000
@@ -7,9 +7,9 @@
 while(1)
 {
     Greifer.take();
-    wait(1.0f);
+    wait(5.0f);
     Greifer.leave();
-    wait(1.0f);
+    wait(5.0f);
 }