Hi @paulwece
In order:
-
Read the topic " How to get the best out of this forum ";
-
When posting sketch in topic format it, and use </> tags;
-
These instructions do the following: (Simplified explanation).
PORTD |= (1 << 2) and PORTD &= ~(1 << 2).
PORTD |= (1 << 2) . Shift the number 1 to the left 2 bits and write to PORTD.
<< means shitf left
PORTD &= ~(1 << 2). Shift the number 0 to the left 2 bits and write to PORTD.
~ means the inverse of 1 = 0.
Port D bit 2 is pin 2 of the arduino and in the sketch it was used for step; -
The project author uses Serial.begin(9600) for DEBUG, but it can be removed.
-
I don't recommend using the USB 5V source as a stepper motor consumes a lot of
current and the USB can be damaged.
Also 5V is not a good voltage to move stepper motors.
RV mineirin