Robotcontrol groep 2

Dependencies:   Encoder MODSERIAL mbed HIDScope

Revision:
10:e628a87d18aa
Parent:
9:80693874f9ce
Child:
11:97759ceeb638
--- a/main.cpp	Mon Nov 03 21:50:42 2014 +0000
+++ b/main.cpp	Mon Nov 03 22:44:19 2014 +0000
@@ -345,8 +345,8 @@
     if (y1>0 && y2>0 && check>0) {
         badjedone=1;
         check=0;
-        rood = 1;
-        groen = 0;
+        /*rood = 1;
+        groen = 0;*/
         cout<<"ga naar mode 2"<<endl;
         wait(0.2);
     } else if (y1>0 && y2>0) {
@@ -397,16 +397,16 @@
     switch(k)
     {
         case 1:
-            maxpwm=0.2;
+            maxpwm=0.2; //DE MAX PWM'en AANPASSEN VOOR DE ANDERE CASES!!!!
             break;
         case 2:
-            maxpwm=0.5;
+            maxpwm=0.2;
             break;
         case 3:
-            maxpwm=0.8;
+            maxpwm=0.2;
             break;
         case 4:
-            maxpwm=1;
+            maxpwm=0.2;
             break;
         default:
             maxpwm=0;
@@ -472,8 +472,8 @@
     if (y1>0 && y2>0 && check>0) {
         badjedone=2;
         check=0;
-        rood = 0;
-        groen = 1;
+        /*rood = 0;
+        groen = 1;*/
         cout<<"ga naar mode 1"<<endl;
     } else if (y1>0 && y2>0) {
         check=1;
@@ -535,9 +535,9 @@
 // MAIN SCRIPT
 int main()
 {
-    rood = 0;
+    /*rood = 0;
     blauw = 1;
-    groen = 1;
+    groen = 1;*/
     resetarm();
     pc.baud(115200);
     timer.attach(setlooptimerflag,TSAMP);
@@ -567,12 +567,18 @@
             teller=0;
             switch(badjedone) {
                 case 0:
+                    rood=0;
+                    groen=1;
+                    blauw=1;
                     cout<<"fase1"<<endl;
                     badjestand=badje(y1,y2);
                     batposition(badjestand);
                     break;
 
                 case 1:
+                    rood=1;
+                    groen=0;
+                    blauw=1;
                     cout<<"fase2"<<endl;
                     armstand=armposition(y1,y2);
                     gotopos(armstand);
@@ -583,6 +589,10 @@
                     break;
 
                 case 2:
+                    rood=1;
+                    groen=1;
+                    blauw=0;
+                    resetarm();
                     cout<<"sla"<<endl;
                     sla(armstand);
                     resetarm();