Hi Herring Fish
I understand right now that you have code that works as you want it, in normal operation. you just want to have it not chatter when you reset? So that it looks slightly more professional?
I was skimming, but I don’t think you really need a pulldown resistor, as long as your project would not have problems with a single step of the stepper motor during startup (typically, that means 1/200th of a rotation on the motor).
When I suggested very early in the setup (immediately) that you write
pinMode(pin,INPUT);
digitalWrite(pin,HIGH);
The reason for that is because the first step, pinmode input, sets the pins to “high impedance.” meaning they’re really just used for reading voltages in that step (they could not, for example, light an big LED). I said to make them inputs so that you could then write digitalWrite(pin,HIGH) that sets the internal pull-up resistors (automatically inside the arduino).
The pull-ups will work as easily the external pullups, because the drivers only step whenever they have a transition from low to high. So with this you’ll have a single almost imperceivable step, and then no chatter.
The problem is that ultimately you will need to declare
pinMode(pin,OUTPUT);
in order for your digitalWrite()s later on to actually step the motor. When it’s in input mode it’s not useful for powering to step signal on the Pololu drivers. That’s the drawback.
In this sense, I actually just realized it might make sense to ignore all this talk about pinMode(pin,INPUT). The ONE change you ought to make in your sketch is to move the part where you declare the pins to outputs to the top of void Setup(), and then after that also do digitalWrite(pin,LOW). This way they’ll be kept low until you start stepping. Do this for the pins that go to the step inputs on the driver. Don’t do it for all the pins, because I don’t know what other pins you have in your project. But if you example your pin was connected to a 5V battery, and you set it to LOW, then you would suck too much current into that pin (output mode does not have any resistors limiting the current in or out of the arduino. You have to make your circuit so that you don’t pull or sink too much current). But because the step pins on the Pololu driver have resistors, you’re fine in this example
FINAL POINT:
There must be something in your void Setup() that is taking a long time, for some reason. I’m unclear about this - I dont know what you wrote and haven’t carefully examined your response. The arduino bootloader typically does not take very long to go in the main loop (meaning, void setup and then void loop). It might just be the slightest moment of chatter, much much <1 second.