About saving to eeprom.
I think you should include a setup button to your project,
so you can ignore the saved eeprom values during homing/resetting/zeroing of the motors.
Here are some (untested) ideas for "ignore/load" that you can add to setup().
And a function that you can use to write to eeprom.
Leo..
#include <EEPROM.h>
int eeAddress = 0; // address offset
const byte zeroPin = 6; // button between pin and ground
void setup() {
pinMode(zeroPin, INPUT_PULLUP);
if (digitalRead(zeroPin)) { // if not pressed
for (int i = 0; i < motors; i++) {
EEPROM.get(eeAddress, nowPos[i]);
eeAddress += 2; // int is 2 bytes
}
}
}
void eeSave() {
for (int i = 0; i < motors; i++) {
EEPROM.put(eeAddress, nowPos[i]);
eeAddress += 2;
}
}