Stepper Motor Control

The next motor I worked on was the stepper motor which works by turning on multiple coils in a sequence to turn the motor. The code I started with used bit banging to rotate the stepper in one direction at one speed. This code can be found here. First thing I did with this code was to have it react to a sensor, in this case a light dependent resistor(LDR), the LDR used was the NORP12 RS. Using two LDRs and the analog digital converter(ADC) to have the stepper to point in the direction of a light source, the LDRs would be mounted on the stepper so if one LDR was reading more light the stepper would move in that direction until the two LDRs were were reading the same amount of light. The code is shown below:

Continue reading