Skip to content

Commit

Permalink
Fixed #61
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsv committed Jun 1, 2017
1 parent dcd7aa0 commit ce9adc0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
16 changes: 6 additions & 10 deletions l293d/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from time import sleep
from threading import Thread

__version__ = '0.2.4'
__version__ = '0.2.5'


class Config(object):
Expand Down Expand Up @@ -102,13 +102,9 @@ class DC(object):
motor_pins[2] is pinC is L293D pin7 or pin15 : Clockwise positive
"""

# List of pins in use by motor object
motor_pins = [0 for x in range(3)]

exists = True # Used by 'remove' method

def __init__(self, pin_a=0, pin_b=0, pin_c=0):
# Assign parameters to list
self.motor_pins = [0 for x in range(3)]
self.motor_pins[0] = pin_a
self.motor_pins[1] = pin_b
self.motor_pins[2] = pin_c
Expand All @@ -122,14 +118,14 @@ def __init__(self, pin_a=0, pin_b=0, pin_c=0):
for pin in self.motor_pins:
pins_in_use.append(pin)
# Set up GPIO mode for pins
self.gpio_setup(self.motor_pins)
self.gpio_setup()

@staticmethod
def gpio_setup(pins):
def gpio_setup(self):
"""
Set GPIO.OUT for each pin in use
"""
for pin in pins:
for pin in self.motor_pins:
print(pin)
if not Config.get_test_mode():
GPIO.setup(pin, GPIO.OUT)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
setup(
name='l293d',
packages=['l293d'],
version='0.2.4',
version='0.2.5',
author='James Vickery',
author_email='[email protected]',
description=('A Python module to drive motors using '
Expand Down

0 comments on commit ce9adc0

Please sign in to comment.