Change Motor Speed
In this lab we will change motor speed using Pulse Wave Modulation (PWM). We will read a value from a potentiometer and change the motor speed as the value changes.
To use this lab, connect the ends of a 10K potentiomer to the ground and +5 volts. Then connect the center pin of the pot to the Analog pin 0 (A0) of the Arduino. Then connect a male-female wire from Digital Pin 3 to one of the input pins of the motor control. For this lab you can use any one of the four input pins.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
Note that we can only use one of the 6 PWM pins (3, 5, 6, 9, 10 or 11) to control the speed. The other digital outptus do not support PWM.
More to Explore¶
While the program is running, try moving the wire from the digital output pin to any of the other input pins on the motor controller. What happens? Can you make both wheels move? What direction are they moving?