Interesting Code.

Here what it does. Say we get from 0 to 20 for example.



Code:
Steps	Steps //4
0	0 	=> stepArray[0] = %00001010
1	0 	=> stepArray[0] = %00001010
2	0 	=> stepArray[0] = %00001010
3	0 	=> stepArray[0] = %00001010
4	0	=> stepArray[0] = %00001010
5	1	=> stepArray[1] = %00000110	
6	2	=> stepArray[2] = %00000101	
7	3	=> stepArray[3] = %00001001		
8	0	=> stepArray[0] = %00001010
9	1	=> stepArray[1] = %00000110 
10	2	=> stepArray[2] = %00000101
11	3	=> stepArray[3] = %00001001
12	0	=> stepArray[0] = %00001010
13	1	=> stepArray[1] = %00000110 
14	2	=> stepArray[2] = %00000101
15	3	=> stepArray[3] = %00001001	 
16	0	=> stepArray[0] = %00001010
17	1	=> stepArray[1] = %00000110 
18	2	=> stepArray[2] = %00000101
19	3	=> stepArray[3] = %00001001
20	0	=> stepArray[0] = %00001010 
.
..
...
So that array index will take its corresponding port arrangement and drive PORTD with that arrangement.


Steps//4 is the remainder after divided by 4.