Beagle Board - beagleboard.org
De Funct
Published © GPL3+

BeagleBone Black and L298 Motor Driver in Python

This is a small motor driver based around the L298 dual, H-bridge and the BeagleBone Black. It was typed up in Python.

EasyWork in progress1 hour1,450
BeagleBone Black and L298 Motor Driver in Python

Things used in this project

Hardware components

Dual H-Bridge motor drivers L298
SparkFun Dual H-Bridge motor drivers L298
×1
BeagleBone Black
BeagleBoard.org BeagleBone Black
×1
DC motor (generic)
×1

Software apps and online services

Debian Stretch

Story

Read more

Schematics

Schematic of this specific Motor Driver from Open-Electronics.org

This is a nice driver...
L298 schematic pryjsfwnlt

Code

Motor Geaux, Motor Backwards, and Motor Stop...

Python
This 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()

Many Moons!

Just some ideas on getting up and running w/ the L298 and a motor driver from Open-Electronics.org.

Credits

De Funct

De Funct

4 projects • 5 followers
Stay there and someone will find you...
Contact

Comments

Add projectSign up / Login