Skip to content

Commit

Permalink
Merge pull request #792 from yisraeldov/791-motor-pin-factory
Browse files Browse the repository at this point in the history
fixing motors to work with pin_factory
  • Loading branch information
bennuttall committed Sep 17, 2019
2 parents 9cb0e45 + 3ea5ea3 commit ee9e99e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions gpiozero/output_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -1225,12 +1225,15 @@ def __init__(self, forward=None, backward=None, enable=None, pwm=True,
)
PinClass = PWMOutputDevice if pwm else DigitalOutputDevice
devices = OrderedDict((
('forward_device', PinClass(forward)),
('backward_device', PinClass(backward)),
('forward_device', PinClass(forward, pin_factory=pin_factory)),
('backward_device', PinClass(backward, pin_factory=pin_factory)),
))
if enable is not None:
devices['enable_device'] = DigitalOutputDevice(enable,
initial_value=True)
devices['enable_device'] = DigitalOutputDevice(
enable,
initial_value=True,
pin_factory=pin_factory
)
super(Motor, self).__init__(_order=devices.keys(), **devices)

@property
Expand Down

0 comments on commit ee9e99e

Please sign in to comment.