Basically the L293D has 3 digital inputs per motor:
The Enable pin is used to control the speed of the motor
Input pin 1 and 2 is used to control the direction of the motor. Set pin 1 high and pin 2 low to run the motor one way, pin 1 low and pin 2 high to run it the other way. Set both pins low to stop the motor.
The pin outs for the IC are as follows:
I found the sketch that Oomlut provided a bit complex so I wrote my own one:
This sketch uses the serial communication with the Arduino and allows the user to type an 'f' to run the motor forward, 'r' to reverse it and 's' to stop it.
The completed H bridge set up looks like this:
Next I need to add the second motor.
No comments:
Post a Comment