Meadow.Foundation.Grove.Servos.Servo
Servo | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
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
Servo | Meadow Pin |
---|---|
GND | GND |
VCC | 3.3V |
RX | D01 |
TX | D00 |
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