-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a06d33
commit 6703bca
Showing
4 changed files
with
69 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
Source/Meadow.Foundation.Peripherals/Motors.Stepper.Em542s/Driver/Readme.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Meadow.Foundation.Motors.Stepper.Em542s | ||
|
||
**The Leadshine EM542S Stepper Motor Drive** | ||
|
||
The **Em542s** library is designed for the [Wilderness Labs](www.wildernesslabs.co) Meadow .NET IoT platform and is part of [Meadow.Foundation](https://developer.wildernesslabs.co/Meadow/Meadow.Foundation/). | ||
|
||
The **Meadow.Foundation** peripherals library is an open-source repository of drivers and libraries that streamline and simplify adding hardware to your C# .NET Meadow IoT application. | ||
|
||
For more information on developing for Meadow, visit [developer.wildernesslabs.co](http://developer.wildernesslabs.co/). | ||
|
||
To view all Wilderness Labs open-source projects, including samples, visit [github.com/wildernesslabs](https://github.com/wildernesslabs/). | ||
|
||
## Usage | ||
|
||
```csharp | ||
private IStepperMotor stepper; | ||
|
||
public override Task Initialize() | ||
{ | ||
stepper = new Em542s( | ||
Device.Pins.D15.CreateDigitalOutputPort(), | ||
Device.Pins.D14.CreateDigitalOutputPort(), | ||
inverseLogic: true); | ||
|
||
return base.Initialize(); | ||
} | ||
|
||
public override Task Run() | ||
{ | ||
var direction = RotationDirection.Clockwise; | ||
|
||
// max rate for this drive | ||
var rate = new Meadow.Units.Frequency(200, Meadow.Units.Frequency.UnitType.Kilohertz); | ||
|
||
while (true) | ||
{ | ||
Resolver.Log.Info($"{direction}"); | ||
|
||
stepper.Rotate(360f, direction, rate); | ||
Thread.Sleep(1000); | ||
|
||
direction = direction switch | ||
{ | ||
RotationDirection.CounterClockwise => RotationDirection.Clockwise, | ||
_ => RotationDirection.CounterClockwise | ||
}; | ||
} | ||
} | ||
|
||
``` | ||
## How to Contribute | ||
|
||
- **Found a bug?** [Report an issue](https://github.com/WildernessLabs/Meadow_Issues/issues) | ||
- Have a **feature idea or driver request?** [Open a new feature request](https://github.com/WildernessLabs/Meadow_Issues/issues) | ||
- Want to **contribute code?** Fork the [Meadow.Foundation](https://github.com/WildernessLabs/Meadow.Foundation) repository and submit a pull request against the `develop` branch | ||
|
||
|
||
## Need Help? | ||
|
||
If you have questions or need assistance, please join the Wilderness Labs [community on Slack](http://slackinvite.wildernesslabs.co/). |