initial software...get started. This should start and stop the motor(s). I may have made a mistake. It may not revolve in reverse. I will update it in time.
Attach the wiring from the BBB while it is unplugged and there is no power going to the BBB to the L298 motor driver from Open-Electronics.org.
One of the four wires controls the on/off functionality (En A or En B). Then, the other wires, one ground, control forward and backwards capabilities. Attach your other wiring, the wiring for forward/backward, to ln1 and ln2. The En B and ln 3 and ln 4 are for the second motor.
Go to beagleboard.org/latest-images. Grab your image, i.e. preferably the newest available. If your pins are configured for other uses outside of GPIO functionality, use config-pin gpio for each pin that is used.
If this software only goes forward, stops, and shuts down, let me know. If that is too boring, look below. This software will control initialize, start forward, stop, reverse, and stop, and then shuts down and closes the software as it completes.
import Adafruit_BBIO.GPIO as GPIO
import time
Master_Pin = "P9_21"
ln1 = "P9_22"
ln2 = "P9_12"if __name__=="__main__":
GPIO.setup(Master_Pin, GPIO.OUT)
GPIO.output(Master_Pin, GPIO.LOW)
GPIO.setup(ln1, GPIO.OUT)
GPIO.setup(ln2, GPIO.OUT)
GPIO.output(Master_Pin, GPIO.HIGH)
GPIO.output(ln1, GPIO.HIGH)
GPIO.output(ln2, GPIO.LOW)
time.sleep(15)
GPIO.output(Master_Pin, GPIO.HIGH)
GPIO.output(ln1, GPIO.LOW)
GPIO.output(ln2, GPIO.HIGH)
time.sleep(15)
print"I love your body Larry!"
GPIO.output(Master_Pin, GPIO.LOW)
GPIO.output(Master_Pin, GPIO.LOW)
GPIO.cleanup()
If you are wondering about the schematic of this particular motor driver, see the photos section or see here now:
See the L298N, dual H-bridge section for pin connections that need to be made.
Seth
P.S. Use a 12v battery if available. The motors can handle 2A maximum each forward and backwards. The L298 board can handle 5 to 30V DC.
Hello Again,
I am working on a schematic on KiCad w/ the BBB and this L298 motor driver for ideas.
Seth