Arduino Uno Nema 23, DM542T Driver, Control

I ran into the problem mentioned early on this page about code seeming to run twice. I was using a cheap clone nano. When I added some second+ delays the problem went away. When I switched to using an Elegoo uno r3 with the same code, the problem also went away, but without needing any delays. I wasted way too much time on this and would have been happier paying more for a quality arduino to begin with.