Using DC Motors | Adafruit Motor Shield
Maybe your like
- Overview
- FAQ
- Make It!
- Preparation
- Parts List
- Solder It
- Use It!
- Library Install
- Power Usage
- Using RC Servos
- Using Stepper Motors
- Using DC Motors
- AF_DCMotor Class
- AF_Stepper Class
- Resources
- Downloads
- Forums
- Single page
- Feedback? Corrections?
- Text View
-
Adafruit METRO 328 Fully Assembled - Arduino IDE compatible Out of Stock
Using DC Motors
This tutorial is for the now ancient V1 Motor shield. Chances are you have a V2, check out the tutorial https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino This tutorial is for historical reference and previous customers only!
DC motors are used for all sort of robotic projects.
The motor shield can drive up to 4 DC motors bi-directionally. That means they can be driven forwards and backwards. The speed can also be varied at 0.5% increments using the high-quality built in PWM. This means the speed is very smooth and won't vary!
Note that the H-bridge chip is not meant for driving loads over 0.6A or that peak over 1.2A so this is for small motors. Check the datasheet for information about the motor to verify its OK.
To connect a motor, simply solder two wires to the terminals and then connect them to either the M1, M2, M3, or M4. Then follow these steps in your sketch
- Make sure you #include <AFMotor.h>
- Create the AF_DCMotor object with AF_DCMotor(motor#, frequency), to setup the motor H-bridge and latches. The constructor takes two arguments. The first is which port the motor is connected to, 1, 2, 3 or 4. frequency is how fast the speed controlling signal is. For motors 1 and 2 you can choose MOTOR12_64KHZ, MOTOR12_8KHZ, MOTOR12_2KHZ, orMOTOR12_1KHZ. A high speed like 64KHz wont be audible but a low speed like 1KHz will use less power. Motors 3 & 4 are only possible to run at 1KHz and will ignore any setting given
- Then you can set the speed of the motor using setSpeed(speed) where the speed ranges from 0 (stopped) to 255 (full speed). You can set the speed whenever you want.
- To run the motor, call run(direction) where direction is FORWARD, BACKWARD or RELEASE. Of course, the Arduino doesn't actually know if the motor is 'forward' or 'backward', so if you want to change which way it thinks is forward, simply swap the two wires from the motor to the shield.
Page last edited August 27, 2012
Text editor powered by tinymce.
Using Stepper Motors AF_DCMotor Class Related Guides Low Power WiFi Datalogger By Tony DiCola beginner Arduino Lesson 5. The Serial Monitor By Simon Monk beginner 1.8" TFT Display Breakout and Shield By lady ada beginner Electronic Demon Costume By Phillip Burgess beginner Arduino Lesson 4. Eight LEDs and a Shift Register By Simon Monk beginner A REST API for Arduino & the CC3000 WiFi Chip By M. Schwartz beginner Track Your Treats: Halloween Candy GPS Tracker By Tony DiCola beginner Arduino Lesson 12. LCD Displays - Part 2 By Simon Monk beginner Current Limiting Stepper Driver with DRV8871 By Bill Earl beginner Arduino Lesson 7. Make an RGB LED Fader By Simon Monk beginner Your browser does not support the video tag. This links to the guide Silicone Robo-Tentacle. Silicone Robo-Tentacle By Matthew Borgatti beginner IR Sensor By lady ada beginner Affordable HAL 9000 Replica By Phillip Burgess beginner Wave Shield Voice Changer By Phillip Burgess beginner 2.8" TFT Touchscreen By lady ada beginnerCreate Wishlist
× Title Description Close Search SearchCategories
Tag » Arduino Motor Shield 4 Dc Motors Code
-
Arduino L293D Motor Driver Shield Tutorial
-
Controlling A DC Motor With Motor Shield Rev3
-
Control DC, Stepper & Servo With L293D Motor Driver Shield ...
-
Using L293D 4 DC Motors Shield For Arduino UNO And Mega
-
Arduino L293D Motor Driver Shield Tutorial : 8 Steps - Instructables
-
Control Several Motors With Motor Shield V1 And Arduino - AranaCorp
-
Control 4 DC Motor Using L293D DC Motor Sheidl For Arduino
-
Arduino's L293D Motor Driver Shield Guide - Engineers Garage
-
Arduino L293D Motor Driver Shield Control DC, Servo, And Stepper ...
-
L293D Motor Driver Shield For Arduino - MYTECTUTOR
-
[PDF] L293D Based Arduino Motor Shield
-
Using DC Motors | Adafruit Motor Shield V2
-
Quad DC Motor Driver Shield For Arduino - DFRobot
-
Arduino Motor Shield 4 Channel L293D H-Bridge Dc Motor Control ...
Low Power WiFi Datalogger By
Arduino Lesson 5. The Serial Monitor By
1.8" TFT Display Breakout and Shield By
Electronic Demon Costume By
Arduino Lesson 4. Eight LEDs and a Shift Register By
A REST API for Arduino & the CC3000 WiFi Chip By
Track Your Treats: Halloween Candy GPS Tracker By
Arduino Lesson 12. LCD Displays - Part 2 By
Current Limiting Stepper Driver with DRV8871 By
Arduino Lesson 7. Make an RGB LED Fader By
IR Sensor By
Affordable HAL 9000 Replica By
Wave Shield Voice Changer By
2.8" TFT Touchscreen By