I am running a relatively basic program that runs some sensors, and based on their input, moves stepper motors.
From what I understand (correct me if I’m wrong), the code will run through setup once, and then proceed into void loop() ‘forever’.
What happens with our code is that it will run through the loop, but once in a while, at arbitrary points, it will go back to setup and run those processes again, and then continue into loop, as if the program has been restarted. Our code does use the serial monitor (baud rate of 9600), and uses a few Serial.print statements, our arduino and sensors are powered via usb, while the motor is powered by an external power source.
Has anyone encountered this problem, or does anyone know of a fix? If you need the code let me know. I’m hoping this is just a general rule about coding that I am overlooking and can apply to my program.