Remarks
A4988 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
A4988 a4988;
public override Task Initialize()
{
a4988 = new A4988(
step: Device.Pins.D01,
direction: Device.Pins.D00,
ms1Pin: Device.Pins.D04,
ms2Pin: Device.Pins.D03,
ms3Pin: Device.Pins.D02);
return base.Initialize();
}
public override Task Run()
{
var stepDivisors = (StepDivisor[])Enum.GetValues(typeof(StepDivisor));
while (true)
{
foreach (var step in stepDivisors)
{
for (var d = 2; d < 5; d++)
{
Resolver.Log.Info($"180 degrees..Speed divisor = {d}..1/{(int)step} Steps..{a4988.Direction}...");
a4988.RotationSpeedDivisor = d;
a4988.StepDivisor = step;
a4988.Rotate(180);
Thread.Sleep(500);
}
}
a4988.Direction = (a4988.Direction == RotationDirection.Clockwise) ? RotationDirection.CounterClockwise : RotationDirection.Clockwise;
}
}
Sample project(s) available on GitHub
Wiring Example
To wire a A4988 to your Meadow board, connect the following:
A4988 | Meadow Pin |
---|---|
GND | GND |
VCC | 5V |
STEP | D01 |
DIRECTION | D00 |
M1 | D04 |
M2 | D03 |
M3 | D02 |
It should look like the following diagram:
Characteristic | Locus |
---|---|
Inheritance | object > A4988 |
Implements | IDisposable |
Inherited Members | object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() |
Namespace | Meadow.Foundation.Motors.Stepper |
Assembly | A4988.dll |
Syntax
public class A4988 : IDisposable
Constructors
A4988(IPin, IPin)
Creates an instance of the A4988 Stepper Motor Driver
Declaration
public A4988(IPin step, IPin direction)
Parameters
Type | Name | Description |
---|---|---|
IPin | step | The Meadow pin connected to the STEP pin of the A4988 |
IPin | direction | The Meadow pin connected to the DIR pin of the A4988 |
Remarks
You must provide either all of the micro-step (MS) lines or none of them
A4988(IPin, IPin, IPin)
Creates an instance of the A4988 Stepper Motor Driver
Declaration
public A4988(IPin step, IPin direction, IPin enable)
Parameters
Type | Name | Description |
---|---|---|
IPin | step | The Meadow pin connected to the STEP pin of the A4988 |
IPin | direction | The Meadow pin connected to the DIR pin of the A4988 |
IPin | enable | The (optional) Meadow pin connected to the ENABLE pin of the A4988 |
Remarks
A4988 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
A4988 a4988;
public override Task Initialize()
{
a4988 = new A4988(
step: Device.Pins.D01,
direction: Device.Pins.D00,
ms1Pin: Device.Pins.D04,
ms2Pin: Device.Pins.D03,
ms3Pin: Device.Pins.D02);
return base.Initialize();
}
public override Task Run()
{
var stepDivisors = (StepDivisor[])Enum.GetValues(typeof(StepDivisor));
while (true)
{
foreach (var step in stepDivisors)
{
for (var d = 2; d < 5; d++)
{
Resolver.Log.Info($"180 degrees..Speed divisor = {d}..1/{(int)step} Steps..{a4988.Direction}...");
a4988.RotationSpeedDivisor = d;
a4988.StepDivisor = step;
a4988.Rotate(180);
Thread.Sleep(500);
}
}
a4988.Direction = (a4988.Direction == RotationDirection.Clockwise) ? RotationDirection.CounterClockwise : RotationDirection.Clockwise;
}
}
Sample project(s) available on GitHub
Wiring Example
To wire a A4988 to your Meadow board, connect the following:
A4988 | Meadow Pin |
---|---|
GND | GND |
VCC | 5V |
STEP | D01 |
DIRECTION | D00 |
M1 | D04 |
M2 | D03 |
M3 | D02 |
It should look like the following diagram:
A4988(IPin, IPin, IPin, IPin, IPin)
Creates an instance of the A4988 Stepper Motor Driver
Declaration
public A4988(IPin step, IPin direction, IPin ms1Pin, IPin ms2Pin, IPin ms3Pin)
Parameters
Type | Name | Description |
---|---|---|
IPin | step | The Meadow pin connected to the STEP pin of the A4988 |
IPin | direction | The Meadow pin connected to the DIR pin of the A4988 |
IPin | ms1Pin | The (optional) Meadow pin connected to the MS1 pin of the A4988 |
IPin | ms2Pin | The (optional) Meadow pin connected to the MS2 pin of the A4988 |
IPin | ms3Pin | The (optional) Meadow pin connected to the MS3 pin of the A4988 |
Remarks
You must provide either all of the micro-step (MS) lines or none of them
A4988(IPin, IPin, IPin?, IPin?, IPin?, IPin?)
Creates an instance of the A4988 Stepper Motor Driver
Declaration
public A4988(IPin step, IPin direction, IPin? enablePin, IPin? ms1Pin, IPin? ms2Pin, IPin? ms3Pin)
Parameters
Type | Name | Description |
---|---|---|
IPin | step | The Meadow pin connected to the STEP pin of the A4988 |
IPin | direction | The Meadow pin connected to the DIR pin of the A4988 |
IPin | enablePin | The (optional) Meadow pin connected to the ENABLE pin of the A4988 |
IPin | ms1Pin | The (optional) Meadow pin connected to the MS1 pin of the A4988 |
IPin | ms2Pin | The (optional) Meadow pin connected to the MS2 pin of the A4988 |
IPin | ms3Pin | The (optional) Meadow pin connected to the MS3 pin of the A4988 |
Remarks
You must provide either all of the micro-step (MS) lines or none of them
Properties
Direction
Sets or gets the direction of rotation used for Step or Rotate methods
Declaration
public RotationDirection Direction { get; set; }
Property Value
Type | Description |
---|---|
RotationDirection |
Remarks
A4988 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
A4988 a4988;
public override Task Initialize()
{
a4988 = new A4988(
step: Device.Pins.D01,
direction: Device.Pins.D00,
ms1Pin: Device.Pins.D04,
ms2Pin: Device.Pins.D03,
ms3Pin: Device.Pins.D02);
return base.Initialize();
}
public override Task Run()
{
var stepDivisors = (StepDivisor[])Enum.GetValues(typeof(StepDivisor));
while (true)
{
foreach (var step in stepDivisors)
{
for (var d = 2; d < 5; d++)
{
Resolver.Log.Info($"180 degrees..Speed divisor = {d}..1/{(int)step} Steps..{a4988.Direction}...");
a4988.RotationSpeedDivisor = d;
a4988.StepDivisor = step;
a4988.Rotate(180);
Thread.Sleep(500);
}
}
a4988.Direction = (a4988.Direction == RotationDirection.Clockwise) ? RotationDirection.CounterClockwise : RotationDirection.Clockwise;
}
}
Sample project(s) available on GitHub
Wiring Example
To wire a A4988 to your Meadow board, connect the following:
A4988 | Meadow Pin |
---|---|
GND | GND |
VCC | 5V |
STEP | D01 |
DIRECTION | D00 |
M1 | D04 |
M2 | D03 |
M3 | D02 |
It should look like the following diagram:
IsDisposed
Is the object disposed
Declaration
public bool IsDisposed { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
A4988 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
A4988 a4988;
public override Task Initialize()
{
a4988 = new A4988(
step: Device.Pins.D01,
direction: Device.Pins.D00,
ms1Pin: Device.Pins.D04,
ms2Pin: Device.Pins.D03,
ms3Pin: Device.Pins.D02);
return base.Initialize();
}
public override Task Run()
{
var stepDivisors = (StepDivisor[])Enum.GetValues(typeof(StepDivisor));
while (true)
{
foreach (var step in stepDivisors)
{
for (var d = 2; d < 5; d++)
{
Resolver.Log.Info($"180 degrees..Speed divisor = {d}..1/{(int)step} Steps..{a4988.Direction}...");
a4988.RotationSpeedDivisor = d;
a4988.StepDivisor = step;
a4988.Rotate(180);
Thread.Sleep(500);
}
}
a4988.Direction = (a4988.Direction == RotationDirection.Clockwise) ? RotationDirection.CounterClockwise : RotationDirection.Clockwise;
}
}
Sample project(s) available on GitHub
Wiring Example
To wire a A4988 to your Meadow board, connect the following:
A4988 | Meadow Pin |
---|---|
GND | GND |
VCC | 5V |
STEP | D01 |
DIRECTION | D00 |
M1 | D04 |
M2 | D03 |
M3 | D02 |
It should look like the following diagram:
RotationSpeedDivisor
Divisor used to adjust rotational speed of the stepper motor
Declaration
public int RotationSpeedDivisor { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
A4988 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
A4988 a4988;
public override Task Initialize()
{
a4988 = new A4988(
step: Device.Pins.D01,
direction: Device.Pins.D00,
ms1Pin: Device.Pins.D04,
ms2Pin: Device.Pins.D03,
ms3Pin: Device.Pins.D02);
return base.Initialize();
}
public override Task Run()
{
var stepDivisors = (StepDivisor[])Enum.GetValues(typeof(StepDivisor));
while (true)
{
foreach (var step in stepDivisors)
{
for (var d = 2; d < 5; d++)
{
Resolver.Log.Info($"180 degrees..Speed divisor = {d}..1/{(int)step} Steps..{a4988.Direction}...");
a4988.RotationSpeedDivisor = d;
a4988.StepDivisor = step;
a4988.Rotate(180);
Thread.Sleep(500);
}
}
a4988.Direction = (a4988.Direction == RotationDirection.Clockwise) ? RotationDirection.CounterClockwise : RotationDirection.Clockwise;
}
}
Sample project(s) available on GitHub
Wiring Example
To wire a A4988 to your Meadow board, connect the following:
A4988 | Meadow Pin |
---|---|
GND | GND |
VCC | 5V |
STEP | D01 |
DIRECTION | D00 |
M1 | D04 |
M2 | D03 |
M3 | D02 |
It should look like the following diagram:
StepAngle
Gets or sets the angle, in degrees, of one step for the connected stepper motor
Declaration
public Angle StepAngle { get; set; }
Property Value
Type | Description |
---|---|
Angle |
Remarks
A4988 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
A4988 a4988;
public override Task Initialize()
{
a4988 = new A4988(
step: Device.Pins.D01,
direction: Device.Pins.D00,
ms1Pin: Device.Pins.D04,
ms2Pin: Device.Pins.D03,
ms3Pin: Device.Pins.D02);
return base.Initialize();
}
public override Task Run()
{
var stepDivisors = (StepDivisor[])Enum.GetValues(typeof(StepDivisor));
while (true)
{
foreach (var step in stepDivisors)
{
for (var d = 2; d < 5; d++)
{
Resolver.Log.Info($"180 degrees..Speed divisor = {d}..1/{(int)step} Steps..{a4988.Direction}...");
a4988.RotationSpeedDivisor = d;
a4988.StepDivisor = step;
a4988.Rotate(180);
Thread.Sleep(500);
}
}
a4988.Direction = (a4988.Direction == RotationDirection.Clockwise) ? RotationDirection.CounterClockwise : RotationDirection.Clockwise;
}
}
Sample project(s) available on GitHub
Wiring Example
To wire a A4988 to your Meadow board, connect the following:
A4988 | Meadow Pin |
---|---|
GND | GND |
VCC | 5V |
STEP | D01 |
DIRECTION | D00 |
M1 | D04 |
M2 | D03 |
M3 | D02 |
It should look like the following diagram:
StepDivisor
Divisor for micro-stepping a motor
This requires the three micro-step control lines to be connected to the motor
Declaration
public StepDivisor StepDivisor { get; set; }
Property Value
Type | Description |
---|---|
StepDivisor |
Remarks
A4988 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
A4988 a4988;
public override Task Initialize()
{
a4988 = new A4988(
step: Device.Pins.D01,
direction: Device.Pins.D00,
ms1Pin: Device.Pins.D04,
ms2Pin: Device.Pins.D03,
ms3Pin: Device.Pins.D02);
return base.Initialize();
}
public override Task Run()
{
var stepDivisors = (StepDivisor[])Enum.GetValues(typeof(StepDivisor));
while (true)
{
foreach (var step in stepDivisors)
{
for (var d = 2; d < 5; d++)
{
Resolver.Log.Info($"180 degrees..Speed divisor = {d}..1/{(int)step} Steps..{a4988.Direction}...");
a4988.RotationSpeedDivisor = d;
a4988.StepDivisor = step;
a4988.Rotate(180);
Thread.Sleep(500);
}
}
a4988.Direction = (a4988.Direction == RotationDirection.Clockwise) ? RotationDirection.CounterClockwise : RotationDirection.Clockwise;
}
}
Sample project(s) available on GitHub
Wiring Example
To wire a A4988 to your Meadow board, connect the following:
A4988 | Meadow Pin |
---|---|
GND | GND |
VCC | 5V |
STEP | D01 |
DIRECTION | D00 |
M1 | D04 |
M2 | D03 |
M3 | D02 |
It should look like the following diagram:
StepsPerRevolution
Gets the number of steps/micro-steps in the current configuration required for one 360-degree revolution
Declaration
public int StepsPerRevolution { get; }
Property Value
Type | Description |
---|---|
int |
Remarks
A4988 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
A4988 a4988;
public override Task Initialize()
{
a4988 = new A4988(
step: Device.Pins.D01,
direction: Device.Pins.D00,
ms1Pin: Device.Pins.D04,
ms2Pin: Device.Pins.D03,
ms3Pin: Device.Pins.D02);
return base.Initialize();
}
public override Task Run()
{
var stepDivisors = (StepDivisor[])Enum.GetValues(typeof(StepDivisor));
while (true)
{
foreach (var step in stepDivisors)
{
for (var d = 2; d < 5; d++)
{
Resolver.Log.Info($"180 degrees..Speed divisor = {d}..1/{(int)step} Steps..{a4988.Direction}...");
a4988.RotationSpeedDivisor = d;
a4988.StepDivisor = step;
a4988.Rotate(180);
Thread.Sleep(500);
}
}
a4988.Direction = (a4988.Direction == RotationDirection.Clockwise) ? RotationDirection.CounterClockwise : RotationDirection.Clockwise;
}
}
Sample project(s) available on GitHub
Wiring Example
To wire a A4988 to your Meadow board, connect the following:
A4988 | Meadow Pin |
---|---|
GND | GND |
VCC | 5V |
STEP | D01 |
DIRECTION | D00 |
M1 | D04 |
M2 | D03 |
M3 | D02 |
It should look like the following diagram:
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Remarks
A4988 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
A4988 a4988;
public override Task Initialize()
{
a4988 = new A4988(
step: Device.Pins.D01,
direction: Device.Pins.D00,
ms1Pin: Device.Pins.D04,
ms2Pin: Device.Pins.D03,
ms3Pin: Device.Pins.D02);
return base.Initialize();
}
public override Task Run()
{
var stepDivisors = (StepDivisor[])Enum.GetValues(typeof(StepDivisor));
while (true)
{
foreach (var step in stepDivisors)
{
for (var d = 2; d < 5; d++)
{
Resolver.Log.Info($"180 degrees..Speed divisor = {d}..1/{(int)step} Steps..{a4988.Direction}...");
a4988.RotationSpeedDivisor = d;
a4988.StepDivisor = step;
a4988.Rotate(180);
Thread.Sleep(500);
}
}
a4988.Direction = (a4988.Direction == RotationDirection.Clockwise) ? RotationDirection.CounterClockwise : RotationDirection.Clockwise;
}
}
Sample project(s) available on GitHub
Wiring Example
To wire a A4988 to your Meadow board, connect the following:
A4988 | Meadow Pin |
---|---|
GND | GND |
VCC | 5V |
STEP | D01 |
DIRECTION | D00 |
M1 | D04 |
M2 | D03 |
M3 | D02 |
It should look like the following diagram:
Dispose(bool)
Dispose of the object
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | Is disposing |
Remarks
A4988 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
A4988 a4988;
public override Task Initialize()
{
a4988 = new A4988(
step: Device.Pins.D01,
direction: Device.Pins.D00,
ms1Pin: Device.Pins.D04,
ms2Pin: Device.Pins.D03,
ms3Pin: Device.Pins.D02);
return base.Initialize();
}
public override Task Run()
{
var stepDivisors = (StepDivisor[])Enum.GetValues(typeof(StepDivisor));
while (true)
{
foreach (var step in stepDivisors)
{
for (var d = 2; d < 5; d++)
{
Resolver.Log.Info($"180 degrees..Speed divisor = {d}..1/{(int)step} Steps..{a4988.Direction}...");
a4988.RotationSpeedDivisor = d;
a4988.StepDivisor = step;
a4988.Rotate(180);
Thread.Sleep(500);
}
}
a4988.Direction = (a4988.Direction == RotationDirection.Clockwise) ? RotationDirection.CounterClockwise : RotationDirection.Clockwise;
}
}
Sample project(s) available on GitHub
Wiring Example
To wire a A4988 to your Meadow board, connect the following:
A4988 | Meadow Pin |
---|---|
GND | GND |
VCC | 5V |
STEP | D01 |
DIRECTION | D00 |
M1 | D04 |
M2 | D03 |
M3 | D02 |
It should look like the following diagram:
Rotate(float)
Rotates the stepper motor a specified number of degrees
Declaration
public void Rotate(float degrees)
Parameters
Type | Name | Description |
---|---|---|
float | degrees | Degrees to rotate |
Remarks
A4988 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
A4988 a4988;
public override Task Initialize()
{
a4988 = new A4988(
step: Device.Pins.D01,
direction: Device.Pins.D00,
ms1Pin: Device.Pins.D04,
ms2Pin: Device.Pins.D03,
ms3Pin: Device.Pins.D02);
return base.Initialize();
}
public override Task Run()
{
var stepDivisors = (StepDivisor[])Enum.GetValues(typeof(StepDivisor));
while (true)
{
foreach (var step in stepDivisors)
{
for (var d = 2; d < 5; d++)
{
Resolver.Log.Info($"180 degrees..Speed divisor = {d}..1/{(int)step} Steps..{a4988.Direction}...");
a4988.RotationSpeedDivisor = d;
a4988.StepDivisor = step;
a4988.Rotate(180);
Thread.Sleep(500);
}
}
a4988.Direction = (a4988.Direction == RotationDirection.Clockwise) ? RotationDirection.CounterClockwise : RotationDirection.Clockwise;
}
}
Sample project(s) available on GitHub
Wiring Example
To wire a A4988 to your Meadow board, connect the following:
A4988 | Meadow Pin |
---|---|
GND | GND |
VCC | 5V |
STEP | D01 |
DIRECTION | D00 |
M1 | D04 |
M2 | D03 |
M3 | D02 |
It should look like the following diagram:
Rotate(float, RotationDirection)
Rotates the stepper motor a specified number of degrees
Declaration
public void Rotate(float degrees, RotationDirection direction)
Parameters
Type | Name | Description |
---|---|---|
float | degrees | Degrees to rotate |
RotationDirection | direction | Direction of rotation |
Remarks
A4988 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
A4988 a4988;
public override Task Initialize()
{
a4988 = new A4988(
step: Device.Pins.D01,
direction: Device.Pins.D00,
ms1Pin: Device.Pins.D04,
ms2Pin: Device.Pins.D03,
ms3Pin: Device.Pins.D02);
return base.Initialize();
}
public override Task Run()
{
var stepDivisors = (StepDivisor[])Enum.GetValues(typeof(StepDivisor));
while (true)
{
foreach (var step in stepDivisors)
{
for (var d = 2; d < 5; d++)
{
Resolver.Log.Info($"180 degrees..Speed divisor = {d}..1/{(int)step} Steps..{a4988.Direction}...");
a4988.RotationSpeedDivisor = d;
a4988.StepDivisor = step;
a4988.Rotate(180);
Thread.Sleep(500);
}
}
a4988.Direction = (a4988.Direction == RotationDirection.Clockwise) ? RotationDirection.CounterClockwise : RotationDirection.Clockwise;
}
}
Sample project(s) available on GitHub
Wiring Example
To wire a A4988 to your Meadow board, connect the following:
A4988 | Meadow Pin |
---|---|
GND | GND |
VCC | 5V |
STEP | D01 |
DIRECTION | D00 |
M1 | D04 |
M2 | D03 |
M3 | D02 |
It should look like the following diagram:
Step(int)
Rotates the stepper motor a specified number of steps (or microsteps)
Declaration
public void Step(int count)
Parameters
Type | Name | Description |
---|---|---|
int | count | Number of steps to rotate |
Remarks
A4988 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
A4988 a4988;
public override Task Initialize()
{
a4988 = new A4988(
step: Device.Pins.D01,
direction: Device.Pins.D00,
ms1Pin: Device.Pins.D04,
ms2Pin: Device.Pins.D03,
ms3Pin: Device.Pins.D02);
return base.Initialize();
}
public override Task Run()
{
var stepDivisors = (StepDivisor[])Enum.GetValues(typeof(StepDivisor));
while (true)
{
foreach (var step in stepDivisors)
{
for (var d = 2; d < 5; d++)
{
Resolver.Log.Info($"180 degrees..Speed divisor = {d}..1/{(int)step} Steps..{a4988.Direction}...");
a4988.RotationSpeedDivisor = d;
a4988.StepDivisor = step;
a4988.Rotate(180);
Thread.Sleep(500);
}
}
a4988.Direction = (a4988.Direction == RotationDirection.Clockwise) ? RotationDirection.CounterClockwise : RotationDirection.Clockwise;
}
}
Sample project(s) available on GitHub
Wiring Example
To wire a A4988 to your Meadow board, connect the following:
A4988 | Meadow Pin |
---|---|
GND | GND |
VCC | 5V |
STEP | D01 |
DIRECTION | D00 |
M1 | D04 |
M2 | D03 |
M3 | D02 |
It should look like the following diagram:
Step(int, RotationDirection)
Rotates the stepper motor a specified number of steps (or microsteps)
Declaration
public void Step(int count, RotationDirection direction)
Parameters
Type | Name | Description |
---|---|---|
int | count | Number of steps to rotate |
RotationDirection | direction | Direction of rotation |
Remarks
A4988 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
A4988 a4988;
public override Task Initialize()
{
a4988 = new A4988(
step: Device.Pins.D01,
direction: Device.Pins.D00,
ms1Pin: Device.Pins.D04,
ms2Pin: Device.Pins.D03,
ms3Pin: Device.Pins.D02);
return base.Initialize();
}
public override Task Run()
{
var stepDivisors = (StepDivisor[])Enum.GetValues(typeof(StepDivisor));
while (true)
{
foreach (var step in stepDivisors)
{
for (var d = 2; d < 5; d++)
{
Resolver.Log.Info($"180 degrees..Speed divisor = {d}..1/{(int)step} Steps..{a4988.Direction}...");
a4988.RotationSpeedDivisor = d;
a4988.StepDivisor = step;
a4988.Rotate(180);
Thread.Sleep(500);
}
}
a4988.Direction = (a4988.Direction == RotationDirection.Clockwise) ? RotationDirection.CounterClockwise : RotationDirection.Clockwise;
}
}
Sample project(s) available on GitHub
Wiring Example
To wire a A4988 to your Meadow board, connect the following:
A4988 | Meadow Pin |
---|---|
GND | GND |
VCC | 5V |
STEP | D01 |
DIRECTION | D00 |
M1 | D04 |
M2 | D03 |
M3 | D02 |
It should look like the following diagram: