The Arduino motor shield arrives, in size it is the same as the Arduino uno and just sits on top of the Uno:
This is what the motor shield looks like when on top of the Arduino Uno. A motor shield is good as it allows you to control the speed and direction of the motor easily. It is even better for me as it will allow me to power a motor with a separate power supply of up to 12v, which is perfect as my stepper motor is 12V.
I put the motor shield on top of the Arduino Uno and wired up the elements I needed. Below is an image of how I wired up my stepper motor to the Arduino.
I found an example code online to make the motor turn clockwise for a rotation, then anticlockwise:
So I used this code but then made my own adjustments to it to have a longer and faster rotation. I added the black wire onto the motor so it made it easier to see it turning in the videos.
So as you can see from the code in this video, I changed the steps per revolution from 48 to 200, this made the revolution last longer. I also changed the stepper speed from 30 to 50, making it turn faster. This is all part of my experimentation to see how fast I want the fastest speed to be of my final outcome. My next challenge is to add in the Ping Sensor and merge the codes of the two to get them both working off the same board.