Next we used an H-bridge to control the direction of the motor. We chose option 2 in the lab which meant we would solder together our own H-bridge to use in the lab. We obtained the correct circuit board, transistors, resistors, diodes, and soldered everything to the board using the diagram on the circuit board. Here is the H-bridge:
After building the H-bridge, we connected it to our breadboard and also connected the motor across the M+ and M- pins. We used the 5V power supply across the VCC and GND pins. By simply changing the positive and negative to the H-bridge by switching the wires, the motor changed it's direction of spin.
Then we connected IN1 and IN2 to pins 12 and 13 of the Arduino and referred to the code used in the previous lab to turn the motor on for 50ms, stop for 1 second, reverse direction for 50ms, stop for 1 second. This was set up in the loop so that it would continue endlessly.
Lab 8 finished!
No comments:
Post a Comment