Hardware components | ||||||
![]() |
| × | 1 | |||
![]() |
| × | 1 | |||
| × | 2 | ||||
Software apps and online services | ||||||
|
Hello,
After harassing the kind people at Freenode IRC, #beagle and getting some good, juicy info, I went on to an older book and started to understand more about the L298 motor driver.
I also got some good info. from a person on the BBB.io/forum. This fellow helped understand what each lead did for the function of the motor.
Seth
Motor Geaux, Motor Backwards, and Motor Stop...
PythonThis makes one, single motor go forward, go backwards, and stops. Then, the software ends and the motor stops.
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(5)
GPIO.output(Master_Pin, GPIO.HIGH)
GPIO.output(ln1, GPIO.LOW)
GPIO.output(ln2, GPIO.HIGH)
time.sleep(5)
print "I love your body Larry!"
GPIO.output(Master_Pin, GPIO.LOW)
GPIO.output(Master_Pin, GPIO.LOW)
GPIO.cleanup()
RE: On flack, Making Two Motors Go and Do Stuff...
PythonThis is the software to make two motors move around some. I hope to make things more accessible for other people soon. Enjoy...
import Adafruit_BBIO.GPIO as GPIO
import time
Master_Pin1 = "P8_13"
ln1a = "P8_14"
ln1b = "P8_15"
Master_Pin2 = "P8_16"
ln2a = "P8_17"
ln2b = "P8_18"
if __name__=="__main__":
GPIO.setup(Master_Pin1, GPIO.OUT)
GPIO.setup(Master_Pin2, GPIO.OUT)
GPIO.output(Master_Pin1, GPIO.LOW)
GPIO.output(Master_Pin2, GPIO.LOW)
GPIO.output(Master_Pin1, GPIO.HIGH)
GPIO.output(Master_Pin2, GPIO.HIGH)
GPIO.setup(ln1a, GPIO.OUT)
GPIO.setup(ln1b, GPIO.OUT)
GPIO.setup(ln2a, GPIO.OUT)
GPIO.setup(ln2b, GPIO.OUT)
GPIO.output(ln1a, GPIO.HIGH)
GPIO.output(ln1b, GPIO.LOW)
GPIO.output(ln2a, GPIO.HIGH)
GPIO.output(ln2b, GPIO.LOW)
time.sleep(6)
GPIO.output(ln1a, GPIO.HIGH)
GPIO.output(ln1b, GPIO.HIGH)
GPIO.output(ln2a, GPIO.HIGH)
GPIO.output(ln2b, GPIO.HIGH)
time.sleep(6)
GPIO.output(ln1a, GPIO.LOW)
GPIO.output(ln1b, GPIO.HIGH)
GPIO.output(ln2a, GPIO.LOW)
GPIO.output(ln2b, GPIO.HIGH)
print ("I love your body Larry!")
time.sleep(8)
GPIO.output(ln1a, GPIO.LOW)
GPIO.output(ln1b, GPIO.LOW)
GPIO.output(ln2a, GPIO.LOW)
GPIO.output(ln2b, GPIO.LOW)
print ("Waka, Waka, Waka!")
time.sleep(8)
GPIO.output(Master_Pin1, GPIO.LOW)
GPIO.output(Master_Pin2, GPIO.LOW)
GPIO.cleanup()
Comments