Hardware Reference
In-Depth Information
The L293D also has an
enable
pin (pin 9, on the lower right), which is used to control the
speed of the motor by using a PWM signal. (See
Recipe 4.2
for details on how this
works.)
At the end of the code, the
process.on()
function at the end of the code detects when
the user has pressed ^C (Ctrl-C), stops the timer, and turns off the motor. If you don't turn
off the motor, it will continue to spin.
NOTE
The previous example uses a motor that works with 3.3 V. What if you have a 5 V motor?
L293D to the Bone's 5 V power supply. This will work if your motor doesn't draw too much
current.
If 5 V isn't enough voltage, or if the Bone can't supply the current needed,
Figure 4-7
shows
how to use an external power supply.