I have a problem with my accelstepper library. Is it possible, when I call the currentPosition, to save the number of steps, as a constant? I need this to use it as backslash for the motor.
I have a problem with my accelstepper library. Is it possible, when I call the currentPosition, to save the number of steps, as a constant? I need this to use it as backslash for the motor.
Thanks
Serial.print("Backslash: ");
Serial.print (stepper2.currentPosition());
It cannot be saved as a 'constant'. The value of a 'constant' is set at compile-time and can't be changed at runtime.
It can be saved in a 'variable':-
long currentPosition = stepper2.currentPosition();
LarryD:
Made store it in EEPROM.
Invest in a backslash nut.
I thought he was just confusing 'constant' with 'variable'.
If a 'constant' is really needed, to persist between power-ups, you're right - EEPROM.
(No idea what a "backslash" is, in terms of motors.)
I have a Python program sending data to an Arduino to control a small lathe. I measured the number of steps needed to take up the backlash on each axis and I have used them as constants in the Python program. It seems to work very well. When there is a change of direction the extra steps are added to the required move.
Robin2:
I have a Python program sending data to an Arduino to control a small lathe. I measured the number of steps needed to take up the backlash on each axis and I have used them as constants in the Python program. It seems to work very well. When there is a change of direction the extra steps are added to the required move.
...R
That's a better option - hard-coding the values as constants, once you've worked out the exact amount of free-play during testing.
If that's what Kasty is planning, he only needs a 'variable' for current position and then fixed constants to hold the amount of play. In that case, my first reply is still valid.