To figure out which two pins make up a single coil, insert an LED into any two pins on its socket and rotate the motor shaft. If the LED lights up, you found one coil. The other two pins should make up the other coil.
To make a bipolar motor spin:
- Power the first coil.
- Next power the second coil with reverse polarity.
- Then power the first coil with reverse polarity.
- Finally, power the second coil.
Here is code to make the stepper spin in one direction:
Here is code to make the stepper spin in the opposite direction: