Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: eeprom_intern LCD_i2c_GSOE MotorinoLib
Diff: main.cpp
- Revision:
- 4:f863f6847c7d
- Parent:
- 3:302df40c00e2
- Child:
- 5:3a7f58938059
diff -r 302df40c00e2 -r f863f6847c7d main.cpp
--- a/main.cpp Wed Oct 27 16:35:00 2021 +0000
+++ b/main.cpp Thu Oct 28 08:24:50 2021 +0000
@@ -12,51 +12,54 @@
// Blinking rate in milliseconds
#define BLINKING_RATE_MS 50
-Kanal Greifer(0);
-Kanal Basis(1);
-Kanal Oberarm(2);
-
-
struct position
{
- float w[6];
- int ms;
+ float w[6]; //6 Positonmen, Wertebereich: 0..180°, für 6 Achsen
+ int ms; //Fahrzeit in ms zur neuen Position
};
-position schritt[3];
+position schritt[3]; //Es werden 3 Positionen angefahren
int main()
{
- Kanal* achse[6];
- for (int i=0;i<6;i++) achse[i]=new Kanal(i);
+ Kanal* achse[6]; //Der Roboter hat 6 Achsen:
+ //achse[0]: Grundachse, Drehung des Roboters
+ //achse[1]: Erster Kipp-Servo auf der Drehachse
+ //achse[2]: Zweiter Kipp-Servo, von unten her
+ //achse[3]: Dritter Kipp-Servo, von unten her
+ //achse[4]: Drehachse für den Greifer
+ //achse[5]: Greifer
+ for (int i=0;i<6;i++) achse[i]=new Kanal(i); //Die Achsobjekte werden erzeugt
int dtc=0;
// Initialise the digital pin LED1 as an output
- DigitalOut led(LED1);
- schritt[0].w[0]=90;
- schritt[0].w[1]=90;
- schritt[0].w[2]=90;
- schritt[0].w[3]=90;
- schritt[0].w[4]=0;
- schritt[0].w[5]=30;
- schritt[0].ms=1000;
+ DigitalOut led(LED1); //Diagnose LED auf dem Nukleo
+ schritt[0].w[0]=90; //achse[0]: Grundachse, Drehung des Roboters
+ schritt[0].w[1]=90; //achse[1]: Erster Kipp-Servo auf der Drehachse
+ schritt[0].w[2]=90; //achse[2]: Zweiter Kipp-Servo, von unten her
+ schritt[0].w[3]=90; //achse[3]: Dritter Kipp-Servo, von unten her
+ schritt[0].w[4]=90; //achse[4]: Drehachse für den Greifer
+ schritt[0].w[5]=30; //achse[5]: Greifer
+ schritt[0].ms=1000; //Fahrzeit
schritt[1].w[0]=30;
- schritt[1].w[1]=100;
- schritt[1].w[2]=120;
+ schritt[1].w[1]=120;
+ schritt[1].w[2]=130;
schritt[1].w[3]=110;
schritt[1].w[4]=180;
schritt[1].w[5]=100;
schritt[1].ms=500;
schritt[2].w[0]=90;
- schritt[2].w[1]=80;
- schritt[2].w[2]=70;
+ schritt[2].w[1]=60;
+ schritt[2].w[2]=50;
schritt[2].w[3]=80;
schritt[2].w[4]=90;
schritt[2].w[5]=180;
schritt[2].ms=500;
+
+ //Grundstellung nch Start des Nucleo
achse[0]->grundstellung(90);
achse[1]->grundstellung(90);
achse[2]->grundstellung(90);
@@ -68,31 +71,20 @@
for (int j=0;j<2;j++) //Schritte
{
- for (int i=0;i<6;i++) //alle Achsen mit neuen Zielen versorgen und starten
+ //alle Achsen mit neuen Zielen versorgen und starten
+ for (int i=0;i<6;i++)
{
- achse[i]->go(schritt[j].w[i],schritt[j].ms);
+ //Operstion go(´float Zielwinkel, int fahrzeit
+ achse[i]->go(schritt[j].w[i],schritt[j].ms);
}
- for (int i=0;i<6;i++) //warten, dass alle Achsen fertig werden
+ //warten, dass alle Achsen fertig werden
+ for (int i=0;i<6;i++)
{
- while(achse[i]->isBusy());
+ //Operation bool isBusy()
+ //true=Achse bewegt sich noch, false=Achse hat Bewegung beendet
+ while(achse[i]->isBusy()); //-> gleichbedeutend mit .-Operator
}
}
- HAL_Delay(1000);
- /*
- Greifer.go(180,1000);
- Basis.go(90,1000);
- Oberarm.go(0,1000);
- while (Greifer.isBusy()==true);
- while (Basis.isBusy()==true);
- while (Oberarm.isBusy()==true);
- //HAL_Delay(2000);
- Greifer.go(0,500);
- Basis.go(0,500);
- Oberarm.go(120,500);
- //HAL_Delay(1000);
- while (Greifer.isBusy()==true);
- while (Basis.isBusy()==true);
- while (Oberarm.isBusy()==true);
- */
+
}
}