This is the schematic for this example of CNC control with brushed DC motor with optic encoder. Make sure you use the same components value. Check all connections, connect the parts and then uplaod the codes and test the control.