27 Serial.println(
"\n\n\nAccelStepperI2C errror checking demo\n\n");
33 Serial.println(
"Slave not found! Check connections and restart.");
45 ################################
47 if (!checkVersion(
addr)) {
48 Serial.println(
"Warning: Master and slave are not using the same library version.");
49 Serial.print(
"Master version is "); Serial.print(AccelStepperI2C_VersionMajor);
50 Serial.print(
"."); Serial.println(AccelStepperI2C_VersionMinor);
51 uint16_t v = getVersion(
addr);
52 Serial.print(
"Slave version is "); Serial.print(v >> 8);
53 Serial.print(
"."); Serial.println(v & 0xFF);
56 Serial.println(
"Slave's and master's versions match. Proceeding...");
61 Serial.println(
"\nAdding stepper(s)");
87 X->enableInterrupts();
92 if (X->endstops() != 0) {
93 Serial.println(
"\nWarning: Please move stepper away from endstop,\n"
94 "because I don't know in which direction I have to move to get away from it.\n\nHALTING.");
99 Serial.print(
"Endstops found at positions 0 (lower endstop) and ");
100 Serial.print(upperEndStop); Serial.println(
" (upper endstop).\n");
102 Serial.println(
"\n\n\n\n");
103 X->moveTo(upperEndStop / 2);
120 X->setCurrentPosition(0);
126 upperEndStop = X->currentPosition();
143 if (X->endstops() != 0) {
145 Serial.println(
"ran into endstop, returning to middle position.");
146 X->moveTo(upperEndStop / 2);
149 }
else if (!X->isRunning()) {
151 Serial.print(
"target reached, setting new target to ");
152 long offLimits = (upperEndStop *
chance / 100) / 2;
153 long newPos = random(-offLimits, upperEndStop + offLimits) ;
154 Serial.println(newPos);
160 Serial.println(
"\nWarning: Interrupt due to unknown reason\n\nHALTING.");