Control system of Delta-robot BMSTU 2018

Dependencies:   AccelStepper mbed-STM32F103C8T6 mbed

Files at this revision

API Documentation at this revision

Comitter:
yuliyasm
Date:
Wed Jun 20 08:12:18 2018 +0000
Parent:
0:1825dad3704f
Commit message:
final

Changed in this revision

Delta_Robot_2018.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
diff -r 1825dad3704f -r 2bfb79a5ed38 Delta_Robot_2018.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Delta_Robot_2018.lib	Wed Jun 20 08:12:18 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/yuliyasm/code/Delta_Robot_2018/#1825dad3704f
diff -r 1825dad3704f -r 2bfb79a5ed38 main.cpp
--- a/main.cpp	Mon May 21 08:05:59 2018 +0000
+++ b/main.cpp	Wed Jun 20 08:12:18 2018 +0000
@@ -28,9 +28,9 @@
 AccelStepper    axis2(1, stp[1], dir[1]);
 AccelStepper    axis3(1, stp[2], dir[2]);
 AccelStepper    Motors[3] = {axis1, axis2, axis3};
-DigitalIn       zero1(PB_10);
-DigitalIn       zero2(PB_1);
-DigitalIn       zero3(PB_0);
+DigitalIn       zero1(PA_15);
+DigitalIn       zero2(PA_12);
+DigitalIn       zero3(PA_11);
 DigitalIn       zero[3] = {zero1, zero2, zero3};
 DigitalOut      myled(LED1);
 DigitalOut      enb(PA_10);
@@ -66,12 +66,11 @@
         Motors[i].setMaxSpeed (500);
         Motors[i].setAcceleration (100);
         Motors[i].moveTo(-90*q/1.8);
-        Motors[i].setSpeed (50);
     }
-    while(Motors[0].distanceToGo() && Motors[1].distanceToGo() && Motors[2].distanceToGo()) {
+    while(Motors[0].distanceToGo() || Motors[1].distanceToGo() || Motors[2].distanceToGo()) {
         for (int i = 0; i < 3; i++) {
             if(zero[i] != 0)
-                Motors[i].runSpeedToPosition();
+                Motors[i].run();
             else
                 Motors[i].moveTo(Motors[i].currentPosition());
         }
@@ -79,6 +78,8 @@
     for (int i = 0; i < 3; i++) {
         Motors[i].stop();
         Motors[i].setCurrentPosition(0);
+        Motors[i].setMaxSpeed (2000);
+        Motors[i].setAcceleration (500);
     }
     myled = 1;
     pc.printf("Ready\r\n\r\n");