Controlling small motors
Controlling a small motor can be very simple. If the motor is small enough, it can be directly connected to the Arduino pin, and simply turning the pin to HIGH or LOW will control the motor.
This recipe will teach you the basic logic of how to control a motor; however, this is not a typical way of connecting a motor to the Arduino. It is recommended that you first understand this recipe and then apply the following one, Controlling motors with transistors.
Getting ready
Following are the ingredients required to execute this recipe:
- An Arduino board connected to a computer via USB
- A 220-ohm resistor
- A very small DC motor—usually a vibration motor will work—that can be found in old (and new) mobile phones or can typically be brought from websites such as Sparkfun or Adafruit
How to do it…
The following are the steps to connect the motor:
- Just like other small motors, a vibration motor has two wires. Connect one wire to the Arduino GND pin. It doesn&apos...