Skip to content

Commit

Permalink
Update Readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianstevens committed Oct 31, 2023
1 parent 8a06d33 commit 6703bca
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public override Task Initialize()
{
Resolver.Log.Info("Initialize...");

display = new Tm1637(Device, Device.Pins.D02, Device.Pins.D01);
display = new Tm1637(Device.Pins.D02, Device.Pins.D01);

display.Brightness = 7;
display.ScreenOn = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ To view all Wilderness Labs open-source projects, including samples, visit [gith
## Usage

```csharp
readonly Frequency frequency = new Frequency(50, Frequency.UnitType.Hertz);
const float armMs = 0.5f;
const float powerIncrement = 0.05f;

ElectronicSpeedController esc;
RotaryEncoderWithButton rotary;
private readonly Frequency frequency = new Frequency(50, Frequency.UnitType.Hertz);
private const float armMs = 0.5f;
private const float powerIncrement = 0.05f;
private ElectronicSpeedController esc;
private RotaryEncoderWithButton rotary;

public override Task Initialize()
{
Expand All @@ -44,15 +43,15 @@ private void RotaryRotated(object sender, RotaryChangeResult e)
esc.Power += (e.New == RotationDirection.Clockwise) ? powerIncrement : -powerIncrement;
DisplayPowerOnLed(esc.Power);

Resolver.Log.Info($"New Power: {esc.Power * (float)100:n0}%");
Resolver.Log.Info($"New Power: {esc.Power * 100:n0}%");
}

/// <summary>
/// Displays the ESC power on the onboard LED as full red @ `100%`,
/// blue @ `0%`, and a proportional mix, in between those speeds.
/// </summary>
/// <param name="power"></param>
void DisplayPowerOnLed(float power)
private void DisplayPowerOnLed(float power)
{
// `0.0` - `1.0`
int r = (int)ExtensionMethods.Map(power, 0f, 1f, 0f, 255f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To view all Wilderness Labs open-source projects, including samples, visit [gith
## Usage

```csharp
A4988 a4988;
private A4988 a4988;

public override Task Initialize()
{
Expand Down
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/).

0 comments on commit 6703bca

Please sign in to comment.