Meadow.Foundation.FeatherWings.ServoWing
| ServoWing | |
|---|---|
| Status | |
| Source code | GitHub |
| Datasheet(s) | GitHub |
| NuGet package |
Code Example
ServoWing servoWing;
AngularServo servo;
public override Task Initialize()
{
Console.WriteLine("Initializng ...");
servoWing = new ServoWing(Device.CreateI2cBus(I2cBusSpeed.FastPlus));
servo = servoWing.GetServo(0,
new AngularServo.PulseAngle(NamedServoConfigs.SG90.MinimumAngle, new TimePeriod(NamedServoConfigs.SG90.MinimumPulseDuration, TimePeriod.UnitType.Milliseconds)),
new AngularServo.PulseAngle(NamedServoConfigs.SG90.MaximumAngle, new TimePeriod(NamedServoConfigs.SG90.MaximumPulseDuration, TimePeriod.UnitType.Milliseconds)));
return Task.CompletedTask;
}
public override async Task Run()
{
while (true)
{
Console.WriteLine("0");
servo.RotateTo(new Angle(0, AU.Degrees));
await Task.Delay(1000);
Console.WriteLine("45");
servo.RotateTo(new Angle(45, AU.Degrees));
await Task.Delay(1000);
Console.WriteLine("90");
servo.RotateTo(new Angle(90, AU.Degrees));
await Task.Delay(1000);
Console.WriteLine("135");
servo.RotateTo(new Angle(135, AU.Degrees));
await Task.Delay(1000);
}
}
Sample project(s) available on GitHub
API Reference
Class ServoWing
Represents Adafruit's Feather Servo Wing and 16-Channel 12-bit PWM/Servo Shield
Assembly: ServoWing.dll
View Source
Declaration
public class ServoWing
Methods
GetServo(byte, PulseAngle, PulseAngle)
Returns the specified servo
View Source
Declaration
public AngularServo GetServo(byte portIndex, AngularServo.PulseAngle minPulseAngle, AngularServo.PulseAngle maxPulseAngle)
Returns
Meadow.Foundation.Servos.AngularServo
Parameters
| Type | Name | Description |
|---|---|---|
System.Byte | portIndex | |
Meadow.Foundation.Servos.AngularServo.PulseAngle | minPulseAngle | The pulse angle corresponding to the minimum angle of the servo. |
Meadow.Foundation.Servos.AngularServo.PulseAngle | maxPulseAngle | The pulse angle corresponding to the maximum angle of the servo. |
GetContinuousRotatioServo(byte, TimePeriod, TimePeriod)
Returns the specified continues rotation servo
View Source
Declaration
public IContinuousRotationServo GetContinuousRotatioServo(byte portIndex, TimePeriod minimumPulseDuration, TimePeriod maximumPulseDuration)
Returns
Meadow.Peripherals.Servos.IContinuousRotationServo
Parameters
| Type | Name | Description |
|---|---|---|
System.Byte | portIndex | |
Meadow.Units.TimePeriod | minimumPulseDuration | The minimum pulse duration for the servo. |
Meadow.Units.TimePeriod | maximumPulseDuration | The maximum pulse duration for the servo. |