Hello,
I want to compare the actual position with the target position with an arduino mega. So that I can send a command to my machine (3D printer, CoreXY) if the actual position does not match the target position. For example if a motor is blocked a wrong movement is carried out as a result. This can lead to defective components in 3D printing. I now want my machine to receive a command from the Arduino so that it correctly executes the previously incorrect movement.
My question now is which commands do I have to compare with each other?
I have already found the arduino code but only the current position is retrieved every 10 s.
// print motor positions in a 10s loop
if (c == 'p') {
static const unsigned long duration = 10000;
unsigned long start = millis();
while(millis() - start < duration) {
for (int motor = 0; motor < 2; ++motor) {
odrive_serial << "r axis" << motor << ".encoder.pos_estimate\n";
Serial << odrive.readFloat() << '\t';
Many thanks
Tim.