Minor BioRobotics BMT Hierbij publish ik mijn code public ter inspiratie voor komende jaarlagen. Het gaat om een serial robot met twee links en een haak als end-effector. Veel plezier ermee!

Dependencies:   mbed QEI HIDScope biquadFilter MODSERIAL FastPWM

Revision:
19:483fc61778f0
Parent:
18:8bfc1821d412
Child:
20:682ac5b520a0
--- a/main.cpp	Wed Oct 30 13:51:33 2019 +0000
+++ b/main.cpp	Wed Oct 30 15:11:06 2019 +0000
@@ -152,9 +152,9 @@
     // 4.1 Hidscope ****************************************************************
     void HIDScope() //voor HIDscope
     {
-        scope.set(0, emg0_signal);
-        scope.set(1, emg0_max);
-        scope.set(2, emg_tijd); 
+        scope.set(0, 1);
+   //     scope.set(1, error1_motor1);
+   //     scope.set(2, emg_tijd); 
    //     scope.set(3, emg3_signal);
    //    scope.set(4, Ui_motor1);
    //    scope.set(5, Uk_motor1);
@@ -314,20 +314,22 @@
     void motor1_controller(void)
     {
         error1_motor1 = (Yref_motor1 - positie_motor1);
-        if (motor1_calibrated==true&&motor2_calibrated==true)
+        motor1_pwm();
+        /*if (motor1_calibrated==true&&motor2_calibrated==true)
             {
                 motor1_pwm();
-            }
+            } */
         
     }
 
     void motor2_controller(void)
     {
         error1_motor2 = (Yref_motor2 - positie_motor2);
-        if (motor1_calibrated==true&&motor2_calibrated==true)
+        motor2_pwm();
+        /* if (motor1_calibrated==true&&motor2_calibrated==true)
             {
                 motor2_pwm();
-            }
+            } */
     }   
     
 void emg0_processing()
@@ -522,6 +524,10 @@
 
 state_machine() ;
 
+//test stuff:
+Yref_motor1= 4200*pot2_rechts.read();
+Yref_motor2= 4200*pot1_links.read();
+
 // 5.1 Measure Analog and Digital input signals ********************************
 
 // 5.2 Run state-machine(s) ****************************************************