Andruino R4 Wifi stepper stops working

I Got a R4 Wifi the problem is after some spins the stepper stops spinning
the servo works and sweep when i do this in the loop
comet out

//sweeper1neck.Update();

the stepper works

on a Arduino Nano it everything works

#include "Arduino_LED_Matrix.h"
ArduinoLEDMatrix matrix;
#include <Servo.h>
#include "Heartbeatinfill.h"
#include "Eftelinglogo.h"
//#include <WiFi.h>
//#include <HardwareSerial.h>

#include <SoftwareSerial.h>
#include "AccelStepper.h"
#include <DFRobotDFPlayerMini.h>

int serial1 = 11;
int serial2 = 10;

//HardwareSerial mySerial(2);  // Use UART1 (Serial1 on ESP32)
SoftwareSerial mySerial(serial1, serial2); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
void printDetail(uint8_t type, int value);
# define Start_Byte 0x7E
# define Version_Byte 0xFF
# define Command_Length 0x06
# define End_Byte 0xEF
# define Acknowledge 0x00

//Wifi settings
#include <WiFiS3.h>
#include "wifisettings.h" 

#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
#include <Arduino_NetworkConfigurator.h>
#include "thingProperties.h"
char ssid[] = SECRET_SSID;        // your network SSID (name)
char pass[] = SECRET_PASS;    // your network password (use for WPA, or use as key for WEP)
int status = WL_IDLE_STATUS;     // the WiFi radio's status




//Servos Eyes
Servo ServoEyes;
Servo ServoNeckRotate;

int volume = 30;

int poseye = 40;
int posneckupdown = 75;

const int volumeMute = 32;
const int volumeUP = 33;
const int volumeDOWN = 4;

int servoPinneckRotate = 13;	
int servoPineyes = 12;
int buttonState = 0;  

int lastButtonState = HIGH;
bool isMuted = false;
int savedVolume = 15;
bool stepperRunning;

//StepMotor
const int stepsPerRevolution = 2038;
#define HALFSTEP 4

// Motor pin definitions:
#define motorPin1  5      // IN1 on the ULN2003 driver
#define motorPin2  6      // IN2 on the ULN2003 driver
#define motorPin3  7     // IN3 on the ULN2003 driver
#define motorPin4  8     // IN4 on the ULN2003 driver
#define MotorInterfaceType 4
int endPoint = 1024;
//AccelStepper stepper(HALFSTEP, 5, 7, 6, 8);
AccelStepper stepper(MotorInterfaceType, motorPin1, motorPin3, motorPin2, motorPin4);

#define home_switch 4  // Pin 9 connected to Home Switch (MicroSwitch)
int move_finished = 1;     // Used to check if move is completed
long initial_homing = 1;
const int homeSwitchPin = 4; // Connect your limit switch or hall sensor here




void setup() {
  Serial.begin(115200);  // Initializes Serial Monitor for debugging (USB output to PC)
  mySerial.begin(9600);  // RX, TX (DFPlayer communication)

//Wifi Conection

  // check for the WiFi module:
  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");
    // don't continue
    while (true);
  }

  String fv = WiFi.firmwareVersion();
  if (fv < WIFI_FIRMWARE_LATEST_VERSION) {
    Serial.println("Please upgrade the firmware");
  }
  // attempt to connect to WiFi network:
  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network:
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(10000);
  }  

  // you're connected now, so print out the data:
  Serial.print("You're connected to the network");
  printCurrentNet();
  printWifiData();

  


  //pinMode(limitSwitchPin, INPUT_PULLUP); // Internal pull-up resistor
  //myStepperdown.setSpeed(10);

  //LedMatrix
  //matrix.loadFrame(HeartBeat);
  //matrix.loadSequence(Heartbeatinfill);
  matrix.loadSequence(Eftelinglogo);
  //matrix.begin();
  //matrix.play(true);

 
  //  DFPlayer Startup
  Serial.println("Initializing DFPlayer...");
	  //  Tries to initialize DFPlayer and prints error if failed
  if (!myDFPlayer.begin(mySerial)) {
    Serial.println("DFPlayer not detected.");  //  Shown if no communication with DFPlayer
    while (1);  //  Stops further execution
  }
  Serial.println("DFPlayer connected!");
  myDFPlayer.volume(25);  // Set volume (0 to 30)
	Serial.println("DFPlayer volume 25");
  //myDFPlayer.play(2);     // Play first track (0001.mp3)
  Serial.println("DFPlayer Intro");
	myDFPlayer.loop(2);


	//ServoEyes.setPeriodHertz(50);    // standard 50 hz servo
	ServoEyes.attach(servoPineyes, 500, 2400); // attaches the servo on pin 18 to the servo object
	//ServoNeckRotate.setPeriodHertz(50);    // standard 50 hz servo
	ServoNeckRotate.attach(servoPinneckRotate, 500, 2400); // attaches the servo on pin 18 to the servo object
	ServoEyes.write(40);
  ServoNeckRotate.write(75);
  
  // using default min/max of 1000us and 2000us
	// different servos may require different min/max settings
	// for an accurate 0 to 180 sweep
	pinMode(volumeMute, INPUT);
	pinMode(volumeUP, INPUT);
	pinMode(volumeDOWN, INPUT);
	digitalWrite(volumeMute, HIGH);
	digitalWrite(volumeUP, HIGH);
  digitalWrite(volumeDOWN, HIGH);
  stepperhome();
  int stepperRunning = true;
  //stepper.moveTo(8000);
  //matrix.loadSequence(Heartbeatinfill);  
  //myDFPlayer.play(1);     // Play first track (0001.mp3)
  Serial.println("DFPlayer Langnek Verhaal");
	myDFPlayer.loop(1);

}


//wifi conection2
void printWifiData() {
  // print your board's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  
  Serial.println(ip);

  // print your MAC address:
  byte mac[6];
  WiFi.macAddress(mac);
  Serial.print("MAC address: ");
  printMacAddress(mac);
}
void printCurrentNet() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print the MAC address of the router you're attached to:
  byte bssid[6];
  WiFi.BSSID(bssid);
  Serial.print("BSSID: ");
  printMacAddress(bssid);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.println(rssi);

  // print the encryption type:
  byte encryption = WiFi.encryptionType();
  Serial.print("Encryption Type:");
  Serial.println(encryption, HEX);
  Serial.println();
}
void printMacAddress(byte mac[]) {
  for (int i = 0; i < 6; i++) {
    if (i > 0) {
      Serial.print(":");
    }
    if (mac[i] < 16) {
      Serial.print("0");
    }
    Serial.print(mac[i], HEX);
  }
  Serial.println();
}




//Stepper Homing
void stepperhome (){
ServoEyes.write(40);
ServoNeckRotate.write(100);
Serial.println("Homing in progress...  (Langnek)");
Serial.println("");
pinMode(home_switch, INPUT_PULLUP);
  //  Set Max Speed and Acceleration of each Steppers at startup for homing
  stepper.setMaxSpeed(700);      // Set Max Speed of Stepper (Slower to get better accuracy)
  stepper.setAcceleration(250);  // Set Acceleration of Stepper
  //stepper.setSpeed(0);

  // Start Homing procedure of Stepper Motor at startup
 while (digitalRead(home_switch)) {  // Make the Stepper move CCW until the switch is activated
   stepper.setMaxSpeed(700.0);      // Set Max Speed of Stepper (Slower to get better accuracy)
   stepper.setAcceleration(250.0);
   //stepper.setSpeed(0);
   stepper.moveTo(initial_homing);  // Set the position to move to
   initial_homing--;                 // Decrease by 1 for next move if needed
   stepper.run();                   // Start moving the stepper
   stepper.runSpeed();
   //delay(0);
 }

  stepper.setCurrentPosition(0);   // Set the current position as zero for now
  stepper.setMaxSpeed(700.0);      // Set Max Speed of Stepper (Slower to get better accuracy)
  stepper.setAcceleration(250.0);  // Set Acceleration of Stepper
  initial_homing = 1;
  stepper.setCurrentPosition(0);
  Serial.println("Homing Langenek Completed");
  Serial.println("");
  stepper.setMaxSpeed(700.0);      // Set Max Speed of Stepper (Faster for regular movements)
  stepper.setAcceleration(250.0);

}




//Eyes Rotate
//int servoPosition = 40;     // the current angle of the servo - starting at 90.
//int servoSlowInterval = 80; // millisecs between servo moves
//int servoFastInterval = 80;
//int servoInterval = servoSlowInterval; // initial millisecs between servo moves
//int servoDegrees = 2; 
//unsigned long currentMillis = 0;    // stores the value of millis() in each iteration of loop()
//unsigned long previousServoMillis = 0; // the time when the servo was last moved
//const int servoMinDegrees = 20; // the limits to servo movement
//const int servoMaxDegrees = 60;


class Sweeper
{
  //Class Member Varialbes
  //These are initialized at startup
  //ServoEyes servo;              // the servo
  int pos =40;              // current servo position
  int posneck =100;              // current servo position
  
  // These maintain the current state 
  int increment;        // increment to move for each interval
  int  updateInterval;      // interval between updates
  unsigned long lastUpdate; // last update of position
  
  // Constructor - creates a Flasher 
  // and initializes the member variables and state 
public: 
  Sweeper(int interval)
  {
    updateInterval = interval;
    increment = 1;
  }
  
  void Attach(int pin)
  {
    ServoEyes.attach(servoPineyes);
  }
  
  void Detach()
  {
    ServoEyes.detach();
  }
  
  void Update()
  {
    if((millis() - lastUpdate) > updateInterval)
    {
      lastUpdate = millis();
      pos += increment;
      
      ServoEyes.write(pos);
      //Serial.println(pos);
      if ((pos >= 60) || (pos <= 20)) // end of sweep     
      {
        // reverse direction
        increment = -increment;
      }
     }
   }
};



//Neck Rotate
class Sweeperneck
{
  //Class Member Varialbes
  //These are initialized at startup
  //ServoEyes servo;              // the servo
  int pos =40;              // current servo position
  int posneck =100;              // current servo position
  
  // These maintain the current state 
  int increment;        // increment to move for each interval
  int  updateInterval;      // interval between updates
  unsigned long lastUpdate; // last update of position
  
  // Constructor - creates a Flasher 
  // and initializes the member variables and state 
public: 
  Sweeperneck(int interval)
  {
    updateInterval = interval;
    increment = 1;
  }
  
  void Attach(int pin)
  {
    ServoNeckRotate.attach(servoPinneckRotate);
  }
  
  void Detach()
  {
    ServoNeckRotate.detach();
  }
  
  void Update()
  {
    if((millis() - lastUpdate) > updateInterval)
    {
      lastUpdate = millis();
      posneck += increment;
      
      ServoNeckRotate.write(posneck);
      //ServoNeckRotate.write(70);
      //Serial.println(pos);
      if ((posneck >= 130) || (posneck <= 70)) // end of sweep     
      {
        // reverse direction
        increment = -increment;
      }
     }
   }
};











Sweeper sweeper1(50);
Sweeperneck sweeper1neck(50);
stepper.setCurrentPosition = 0;


//const unsigned long MsecPeriod = 15;
//      unsigned long msec0;
//int pos = 40;    // variable to store the servo position
//int dir = 1;

//Loop Works
void loop() 
{
    {

stepper.setMaxSpeed(700);      // Set Max Speed of Stepper (Slower to get better accuracy)
stepper.setAcceleration(250);
stepper.moveTo(210000);
Serial.println("Up Langenek");
Serial.println("Eyes Left Right");
Serial.println("Neck Left Right");
  while(stepper.distanceToGo() > 0) {
    sweeper1.Update();
    sweeper1neck.Update();
    stepper.run();
  }
stepper.setMaxSpeed(700);      // Set Max Speed of Stepper (Slower to get better accuracy)
stepper.setAcceleration(250);
stepper.moveTo(0);
Serial.println("Down Langenek");
Serial.println("Eyes Left Right");
Serial.println("Neck Left Right");
 while(stepper.distanceToGo() != 0) {
    sweeper1.Update();
    sweeper1neck.Update();
    stepper.run();
 }}
    }










void volumeINC()
{
volume = volume+1;
if(volume==31)
{
volume=30;
}
exe_cmd(0x06, 0, volume);
delay(500);
}


void volumeDEC()
{
volume = volume-1;
if(volume==-1)
{
volume=0;
}
exe_cmd(0x06, 0, volume);
delay(500);
}


void exe_cmd(byte CMD, byte Par1, byte Par2)
{
word checksum = -(Version_Byte + Command_Length + CMD + Acknowledge + Par1 + Par2);
byte Command_line[10] = { Start_Byte, Version_Byte, Command_Length, CMD, Acknowledge, Par1, Par2, highByte(checksum), lowByte(checksum), End_Byte};
for (byte x=0; x<10; x++)
{
mySerial.write(Command_line[x]);
}
}

void mp3story() {
	myDFPlayer.volume(30);  // Set volume (0 to 30)
	Serial.println("DFPlayer volume 30");
  myDFPlayer.play(2);     // Play first track (0001.mp3)
  Serial.println("DFPlayer Langnek");
	myDFPlayer.loop(1);

}


void serverstory() {


}

Be more descriptive. 2? 5? 736? Repeatable? Random?

It is ramdom rotations it stops
When i conmit out the neck feature in the loop it works see the code on the nano all servos works

Are you certain?

Why do you do this six times? Do it one time.

Be more descriptive, or show the line to which you refer.

Does distanceToGo count to zero?

Does this line have any effect?

Have you addressed the similar questions and suggestions in your other topic of the same subject?

First of all, it’s absolutely essential to revise and tidy up the sketch. There are duplicate definitions, only one of which is used, as well as what appear to be remnants of experiments and other inconsistencies. You should also run an AutoFormat – that will make some things more obvious.
Furthermore, many files are included whose contents are currently unknown. Much of it is also only understandable if you’re familiar with your original sketch linked by @xfpd.
It doesn't make sense to open a new topic because too much knowledge of your first topic is needed to understand your problem.
It’s impossible to help you this way.

BTW– did you write this sketch yourself, and do you understand it? Or where does it come from?
In your other topic you wrote, you are new to coding. So I doubt that you really understand this complex ( and messy ) sketch and wrote it yourself.

When switching to the R4 Wifi proceed step by step. First get all of the base functionaity running ( that already works on the Nano). Without WiFi and LedMatrix. Then expand the sketch step by step to identify what is causing the malfunction.

Then use the Nano and forget about the R4

Your sketch seems to check for only one limit switch at one end of the "neck." And, have you verified your sketch moves the stepper in both directions?

Your sketch should check for a limit switch at both ends of the "neck" (top and bottom) and move the head in both directions (up and down), then send the head "home" at correct end.

To move the servos (for eyes and head) without creating a class, you could count servo steps to know when to reverse the eyes direction, changing the servo degree angle for a given number of stepper steps. If you want the eyes to move faster than the head, use a ratio of eyes-to-head movement, for example; head only moves one degree, and eyes move five degrees.

the switch is for homing : is in the setup if you start the andruino it runs the homing progress

stepper.setCurrentPosition(0);

from there is goes up with this code

stepper.moveTo(210000);

after that is goes down to zero with this code

stepper.moveTo(0);

the code is a messy but it works on a nano but on the R4 Wifi the neck stops working i wanna try the pwnservo.h option is that a good idea mow is the standart servo.h

That seems to be a coincidence, as Accelstepper is used wrong at some points. Maybe this is the reason it does not work on R4.
You should first clean up the sketch. Remove all unused codesegments. And try the Nano code on R4 without that many R4-extensions. See if it works and then add additional features step by step.

I don't think this will help.

@chello21
This is a cleaned up sketch for the servo and stepper movement using MobaTools. I removed the DF-Player ( I don't have one ), but it schould be easy to add that again. As you can see the sketch is a lot shorter. It should run on an R4 too.

/* This is only for steppers and Servos
*/
#include <MobaTools.h>

// Servos
MoToServo ServoEyes;
MoToServo ServoNeckRotate;
const byte servoPinneckRotate = 9;
const byte servoPineyes = 12;
const int eyeMinDegrees = 20;  // the limits to servo movement
const int eyeMaxDegrees = 60;
const int neckMinDegrees = 30;  // the limits to servo movement
const int neckMaxDegrees = 110;

//StepMotor
const int stepsPerRevolution = 2038;

// Motor pin definitions:
const byte motorPin1 = 5;  // IN1 on the ULN2003 driver
const byte motorPin2 = 6;  // IN2 on the ULN2003 driver
const byte motorPin3 = 7;  // IN3 on the ULN2003 driver
const byte motorPin4 = 8;  // IN4 on the ULN2003 driver
MoToStepper stepper(stepsPerRevolution, HALFSTEP);

const byte home_SwitchPin = 4;  // Pin 4 connected to Home Switch (MicroSwitch)
const long maxNeckSteps = 230000;

void setup() {
  stepper.attach(motorPin1,motorPin2,motorPin3,motorPin4 );
  Serial.begin(115200);  // Initializes Serial Monitor for debugging (USB output to PC)

  ServoEyes.attach(servoPineyes, 600, 2400);              // attaches the servo on pin 18 to the servo object
  ServoEyes.setSpeedTime(4500);                           // The time the servo needs from 0 to 180 deg.
  ServoNeckRotate.attach(servoPinneckRotate, 600, 2400);  // attaches the servo on pin 18 to the servo object
  ServoNeckRotate.setSpeedTime(4500);

  // using default min/max of 1000us and 2000us ???
  // different servos may require different min/max settings
  // for an accurate 0 to 180 sweep
  stepperhome();
}

void stepperhome() {
  Serial.println("Homing in progress...  (Langnek)");
  Serial.println("");
  pinMode(home_SwitchPin, INPUT_PULLUP);
  //  Set Max Speed and Acceleration of each Steppers at startup for homing
  stepper.setMaxSpeed(700);                    // Set Max Speed of Stepper (Slower to get better accuracy)
  stepper.setRampLen(stepsPerRevolution / 4);  // Set ramplength of Stepper

  stepper.move(-maxNeckSteps);           // Set the position to move to
  while (digitalRead(home_SwitchPin)) {  // Make the Stepper move CCW until the switch is activated
  }
  stepper.stop();
  stepper.setZero();  // Set the current position as zero for now
  Serial.println("Homing Langenek Completed");
  Serial.println("");
}

void loop() {
  //Stepper movement ( Neck up/doen )
  if (!stepper.moving()) {
    // Neck has reached upper or loer position
    if (stepper.currentPosition() > (maxNeckSteps / 2)) {
      // it is in upper position, so go down now
      Serial.println("Down Langenek");
      stepper.moveTo(0);
    } else {
      // Stepper is in low position, move up
      Serial.println("Up Langenek");
      stepper.moveTo(maxNeckSteps);
    }
  }
  // Eye movement
  if (!ServoEyes.moving()) {
    if (ServoEyes.read() <= eyeMinDegrees) {
     Serial.println("Eyes Left Right");
     ServoEyes.write(eyeMaxDegrees);
    } else {
    Serial.println("Eyes Right Left");
      ServoEyes.write(eyeMinDegrees);
    }
  }
  // Neck movement
  if (!ServoNeckRotate.moving()) {
    if (ServoNeckRotate.read() <= neckMinDegrees) {
      ServoNeckRotate.write(neckMaxDegrees);
    } else {
      ServoNeckRotate.write(neckMinDegrees);
    }
  }
}

this code works only the DF-Player is not working when i add it

Please show your attempt.

I used the same lines of the old code for the dfplayer

Please post your complete sketch here.

/* This is only for steppers and Servos
*/
#include <MobaTools.h>
#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h>
//#include <DFMiniMp3.h>

int serial1 = 11;
int serial2 = 10;

//HardwareSerial mySerial(2);  // Use UART1 (Serial1 on ESP32)
SoftwareSerial mySerial(serial1, serial2); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
void printDetail(uint8_t type, int value);
# define Start_Byte 0x7E
# define Version_Byte 0xFF
# define Command_Length 0x06
# define End_Byte 0xEF
# define Acknowledge 0x00


// Servos
MoToServo ServoEyes;
MoToServo ServoNeckRotate;
const byte servoPinneckRotate = 13;
const byte servoPineyes = 12;
const int eyeMinDegrees = 10;  // the limits to servo movement
const int eyeMaxDegrees = 50;
const int neckMinDegrees = 25;  // the limits to servo movement
const int neckMaxDegrees = 115;

//StepMotor
const int stepsPerRevolution = 2038;

// Motor pin definitions:
const byte motorPin1 = 5;  // IN1 on the ULN2003 driver
const byte motorPin2 = 6;  // IN2 on the ULN2003 driver
const byte motorPin3 = 7;  // IN3 on the ULN2003 driver
const byte motorPin4 = 8;  // IN4 on the ULN2003 driver
MoToStepper stepper(stepsPerRevolution, HALFSTEP);

const byte home_SwitchPin = 4;  // Pin 4 connected to Home Switch (MicroSwitch)
const long maxNeckSteps = 210000;




void setup() {
  stepper.attach(motorPin1,motorPin2,motorPin3,motorPin4 );
  Serial.begin(115200);  // Initializes Serial Monitor for debugging (USB output to PC)
  mySerial.begin(9600);  // RX, TX (DFPlayer communication)
  delay(500);
  
//  DFPlayer Startup
  Serial.println("Initializing DFPlayer...");
  //  Tries to initialize DFPlayer and prints error if failed
  if (!myDFPlayer.begin(mySerial)) {
    Serial.println("DFPlayer not detected.");  //  Shown if no communication with DFPlayer
    //while (1);  //  Stops further execution
  }
  Serial.println("DFPlayer connected!");
    myDFPlayer.volume(25);  // Set volume (0 to 30)
	Serial.println("DFPlayer volume 25");
  //myDFPlayer.play(2);     // Play first track (0001.mp3)
  Serial.println("DFPlayer Intro");
	myDFPlayer.loop(2);


  ServoEyes.attach(servoPineyes, 600, 2400);              // attaches the servo on pin 18 to the servo object
  ServoEyes.setSpeedTime(4500);                           // The time the servo needs from 0 to 180 deg.
  ServoNeckRotate.attach(servoPinneckRotate, 600, 2400);  // attaches the servo on pin 18 to the servo object
  ServoNeckRotate.setSpeedTime(4500);
  ServoNeckRotate.write(80);
  ServoEyes.write(30);
  // using default min/max of 1000us and 2000us ???
  // different servos may require different min/max settings
  // for an accurate 0 to 180 sweep
  stepperhome();
    
}

void stepperhome() {
  Serial.println("Homing in progress...  (Langnek)");
  Serial.println("");
  pinMode(home_SwitchPin, INPUT_PULLUP);
  //  Set Max Speed and Acceleration of each Steppers at startup for homing
  stepper.setMaxSpeed(700);                    // Set Max Speed of Stepper (Slower to get better accuracy)
  stepper.setRampLen(stepsPerRevolution / 4);  // Set ramplength of Stepper

  stepper.move(-maxNeckSteps);           // Set the position to move to
  while (digitalRead(home_SwitchPin)) {  // Make the Stepper move CCW until the switch is activated
  }
  stepper.stop();
  stepper.setZero();  // Set the current position as zero for now
  Serial.println("Homing Langenek Completed");
  Serial.println("");
}

void loop() {
  //Stepper movement ( Neck up/doen )
  if (!stepper.moving()) {
    // Neck has reached upper or loer position
    if (stepper.currentPosition() > (maxNeckSteps / 2)) {
      // it is in upper position, so go down now
      Serial.println("Down Langenek");
      stepper.moveTo(0);
    } else {
      // Stepper is in low position, move up
      Serial.println("Up Langenek");
      stepper.moveTo(maxNeckSteps);
    }
  }
  // Eye movement
  if (!ServoEyes.moving()) {
    if (ServoEyes.read() <= eyeMinDegrees) {
     //Serial.println("Eyes Left Right");
     ServoEyes.write(eyeMaxDegrees);
    } else {
    //Serial.println("Eyes Right Left");
      ServoEyes.write(eyeMinDegrees);
    }
  }
  // Neck movement
  if (!ServoNeckRotate.moving()) {
    if (ServoNeckRotate.read() <= neckMinDegrees) {
      ServoNeckRotate.write(neckMaxDegrees);
    } else {
      ServoNeckRotate.write(neckMinDegrees);
    }
  }
}

You need to un-comment the while(1) line... and format your code.

  if (!myDFPlayer.begin(mySerial)) {
    Serial.println("DFPlayer not detected.");  //  Shown if no communication with DFPlayer
    //while (1);  //  Stops further execution
  }

Ok, I checked that, and there is an incompatibility between SoftwareSerial and MobaTools regarding the usable pins. RX/TX and stepper pins must not be on the same byte port.
The most easiest way is to change TX/RX to A0/A1:

int serialRx = A1;
int serialTx = A0;

SoftwareSerial mySerial(serialRx, serialTx); // RX, TX

And the same sketch works on UNO R4 Wifi if you use the HW Tx/Rx pins of the R4:

//SoftwareSerial mySerial(serialRx, serialTx); // RX, TX
#define mySerial Serial1

the HW Tx/Rx works thanx for the help