Lab 1: Transistor and relay lab
Here is a potentiometer controlling the spinning rate of a DC motor. The higher the value of the potentiometer, the faster the rate of spinning in the potentiometer.
Lab 2: Controlling a DC motor with an H-bridge
Here is the motor changing its spinning direction when the push button is pressed:
Lab 3: Controlling a Stepper motor with an H-bridge
For this lab, it took me a while to be able to figure out the wiring. This was because the instructions in the lab were for a different model of Arduino. In order to be able to use its instruction, I had to translate its ports and the connections to the components to match the ones that I had. While it too me longer and could be a bit frustrating, ultimately it was a fun and useful exercise.
Because my pins on the Arduino were different, I had edit the pin labels in the template code that was given. I updated the code to be the following:
#include "Stepper.h"
 
const int stepsPerRevolution = 512;  // change this to fit the number of steps per revolution
                                     // for your motor
 
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 2, 3, 4 ,5);            
 
int stepCount = 0;         // number of steps the motor has taken
 
void setup() {
  // initialize the serial port:
  Serial.begin(9600);
}
 
void loop() {
  // step one step:
  myStepper.step(1);
  Serial.print("steps:" );
  Serial.println(stepCount);
  stepCount++;
  delay(10);
}
Here are videos of the stepper motor in action:
I updated the rotation rate of the stepper motor. Here you can see it spinning faster as a result.