Skip to content

Add microcontroller pins to example. #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions adafruit_motor/stepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ class StepperMotor:

**PWM**

:param ~pulseio.PWMOut ain1: `pulseio.PWMOut`-compatible output connected to the driver for
:param ~pulseio.PWMOut ain1: ``pulseio.PWMOut``-compatible output connected to the driver for
the first coil (unipolar) or first input to first coil (bipolar).
:param ~pulseio.PWMOut ain2: `pulseio.PWMOut`-compatible output connected to the driver for
:param ~pulseio.PWMOut ain2: ``pulseio.PWMOut``-compatible output connected to the driver for
the third coil (unipolar) or second input to first coil (bipolar).
:param ~pulseio.PWMOut bin1: `pulseio.PWMOut`-compatible output connected to the driver for
:param ~pulseio.PWMOut bin1: ``pulseio.PWMOut``-compatible output connected to the driver for
the second coil (unipolar) or second input to second coil (bipolar).
:param ~pulseio.PWMOut bin2: `pulseio.PWMOut`-compatible output connected to the driver for
:param ~pulseio.PWMOut bin2: ``pulseio.PWMOut``-compatible output connected to the driver for
the fourth coil (unipolar) or second input to second coil (bipolar).
:param int microsteps: Number of microsteps between full steps. Must be at least 2 and even.

Expand Down
23 changes: 18 additions & 5 deletions examples/motor_stepper_digitalio.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use this example for digital pin control of an H-bridge driver
# like a TB6612 or L298N.
# like a DRV8833, TB6612 or L298N.

import time
import board
Expand All @@ -9,13 +9,26 @@
DELAY = 0.01
STEPS = 200

# You can use any available GPIO pin on both a microcontroller and a Raspberry Pi.
# The following pins are simply a suggestion. If you use different pins, update
# the following code to use your chosen pins.

# To use with CircuitPython and a microcontroller:
coils = (
digitalio.DigitalInOut(board.D19), # A1
digitalio.DigitalInOut(board.D26), # A2
digitalio.DigitalInOut(board.D20), # B1
digitalio.DigitalInOut(board.D21), # B2
digitalio.DigitalInOut(board.D9), # A1
digitalio.DigitalInOut(board.D10), # A2
digitalio.DigitalInOut(board.D11), # B1
digitalio.DigitalInOut(board.D12), # B2
)

# To use with a Raspberry Pi:
# coils = (
# digitalio.DigitalInOut(board.D19), # A1
# digitalio.DigitalInOut(board.D26), # A2
# digitalio.DigitalInOut(board.D20), # B1
# digitalio.DigitalInOut(board.D21), # B2
# )

for coil in coils:
coil.direction = digitalio.Direction.OUTPUT

Expand Down