Remarks

Servo
Status Status badge: working
Source code GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Grove.Servos.Servo

Code Example

Servo servo;

public override Task Initialize()
{
    Console.WriteLine("Initialize...");

    servo = new Servo(Device.Pins.D13);

    return Task.CompletedTask;
}

public override async Task Run()
{
    await servo.RotateTo(new Angle(servo.Config.MinimumAngle.Degrees, AU.Degrees));

    while (true)
    {
        for (int i = 0; i <= servo.Config.MaximumAngle.Degrees; i++)
        {
            await servo.RotateTo(new Angle(i, AU.Degrees));
            Console.WriteLine($"Rotating to {i}");
            await Task.Delay(40);
        }

        await Task.Delay(2000);

        for (int i = 180; i >= servo.Config.MinimumAngle.Degrees; i--)
        {
            await servo.RotateTo(new Angle(i, AU.Degrees));
            Console.WriteLine($"Rotating to {i}");
            await Task.Delay(40);
        }

        await Task.Delay(2000);
    }
}

Sample project(s) available on GitHub

Wiring Example

Servo Meadow Pin
GND GND
VCC 3.3V
RX D01
TX D00
Characteristic Locus
Inheritance System.Object ServoBase AngularServoBase Servo > Servo
Implements IAngularServo IServo
Inherited Members AngularServoBase.Angle AngularServoBase.RotateTo(Angle, Boolean) AngularServoBase.CalculatePulseDuration(Angle) ServoBase.PwmPort ServoBase.Config ServoBase.Stop() ServoBase.CalculateDutyCycle(Single) ServoBase.SendCommandPulse(Single)
Namespace Meadow.Foundation.Grove.Servos
Assembly Servo.dll

Syntax

public class Servo : Servo, IAngularServo, IServo

Constructors

Servo(IPin)

Creates a Servo driver

Declaration
public Servo(IPin pwmPin)

Parameters

Type Name Description
IPin pwmPin

Servo(IPwmPort)

Creates a Servo driver

Declaration
public Servo(IPwmPort pwm)

Parameters

Type Name Description
IPwmPort pwm