Controlling a NEMA 17 stepmotor

How to get the best from the forum (forum guidelines).

Also, when you post your code, please post a schematic of your wiring including all components and power supplies. How to make a schematic.