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
main.cpp
- Committer:
- jack1930
- Date:
- 2021-10-27
- Revision:
- 3:302df40c00e2
- Parent:
- 2:e9fbdcb1ee8f
- Child:
- 4:f863f6847c7d
File content as of revision 3:302df40c00e2:
/* mbed Microcontroller Library
* Copyright (c) 2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*/
#include "mbed.h"
#include "platform/mbed_thread.h"
#include "Kanal.h"
// 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;
};
position schritt[3];
int main()
{
Kanal* achse[6];
for (int i=0;i<6;i++) achse[i]=new Kanal(i);
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;
schritt[1].w[0]=30;
schritt[1].w[1]=100;
schritt[1].w[2]=120;
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[3]=80;
schritt[2].w[4]=90;
schritt[2].w[5]=180;
schritt[2].ms=500;
achse[0]->grundstellung(90);
achse[1]->grundstellung(90);
achse[2]->grundstellung(90);
achse[3]->grundstellung(90);
achse[4]->grundstellung(90);
achse[5]->grundstellung(90);
while (true) {
led = !led;
for (int j=0;j<2;j++) //Schritte
{
for (int i=0;i<6;i++) //alle Achsen mit neuen Zielen versorgen und starten
{
achse[i]->go(schritt[j].w[i],schritt[j].ms);
}
for (int i=0;i<6;i++) //warten, dass alle Achsen fertig werden
{
while(achse[i]->isBusy());
}
}
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);
*/
}
}