Skip to content

Instantly share code, notes, and snippets.

@keithweaver
Created March 27, 2017 19:33
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save keithweaver/4e40888cab12a9eadd7a30a0d5477090 to your computer and use it in GitHub Desktop.
Save keithweaver/4e40888cab12a9eadd7a30a0d5477090 to your computer and use it in GitHub Desktop.
Example of using L293D Python Library
# Run the following commands in the terminal/command line:
# pip install l293d
# or (I had to run as root):
# sudo pip install l293d
#
# I also needed to install Yaml
# So:
# pip install pyyaml
# or I had to run with sudo:
# sudo pip install pyyaml
import l293d.driver as l293d
# Motor 1 uses Pin 22, Pin 18, Pin 16
motor1 = l293d.motor(22,18,16)
# Motor 2 uses Pin 15, Pin 13, Pin 11
motor2 = l293d.motor(15,13,11)
# Run the motors so visible
for i in range(0,150):
motor1.clockwise()
motor2.clockwise()
l293d.cleanup()
@RangoCode
Copy link

I need help. It says
Traceback (most recent call last):
File "/home/pi/motortest.py", line 3, in
motor1 = l293d.motor(16,18,22)
AttributeError: 'module' object has no attribute `'motor'```

@jmsv
Copy link

jmsv commented Apr 26, 2018

Hi @RangoCode, l293d has changed a bit since this Gist was made. Check out l293d.readthedocs.io to get started. The repo for this library can be found here: github.com/jmsv/l293d.

Feel free to open an issue if you need any help 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment