Skip to main content

Meadow.Foundation.Grove.Servos.Servo

Servo
StatusStatus badge: working
Source codeGitHub
NuGet packageNuGet Gallery for Meadow.Foundation.Grove.Servos.Servo

Code Example

Servo servo;

public override Task Initialize()
{
Resolver.Log.Info("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));
Resolver.Log.Info($"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));
Resolver.Log.Info($"Rotating to {i}");
await Task.Delay(40);
}

await Task.Delay(2000);
}
}

Sample project(s) available on GitHub

Wiring Example

ServoMeadow Pin
GNDGND
VCC3.3V
RXD01
TXD00

Class Servo

Represents a Grove Servo

Assembly: Servo.dll
View Source
Declaration
public class Servo : Sg90, IDisposable, IAngularServo, IServo

Inheritance: System.Object -> Meadow.Foundation.Servos.ServoBase -> Meadow.Foundation.Servos.AngularServo -> Meadow.Foundation.Servos.Sg90

Implements:
System.IDisposable, Meadow.Peripherals.Servos.IAngularServo, Meadow.Peripherals.Servos.IServo

Implements

  • System.IDisposable
  • Meadow.Peripherals.Servos.IAngularServo
  • Meadow.Peripherals.Servos.IServo