Friday, August 17, 2018

Motor Shield - DC Motor

This entry focuses on using the Motor Shield with DC motors.





Wiring

In the current setup above, the shield is installed on top of the Arduino Uno.  There is USB power going to the arduino, and external power supplied by the Power Supply Module into the DC input of the shield.  The DC motor simply connects into one of the 4 ports.

The four ports can be seen below, labeled as M1, M2, M3 and M4 on the board.


Note that when plugged in such that the red line is in the (+) output and the black is in the (-), the motor will spin in the following direction:


Code

Making use of the MotorShield library, open the

  • Examples > Adafruit Motor Shield V2 Library > DCMotorTest
  • getMotor(#)  // 1-4,  corresponding to M1-M4
  • setSpeed(#)  // 0 - 255


No comments:

Post a Comment