Help with Stepper Motor, Switch and Sensor

There is some very simple step/dir stepper code shown here.