I am using the code bellow to test a Grove Servo in Meadow Lab V3.
using Meadow;
using Meadow.Devices;
using Meadow.Foundation.Grove.Servos;
using Meadow.Units;
using Meadow.Foundation;
using Meadow.Foundation.Leds;
using Meadow.Peripherals.Leds;
using System;
using System.Threading;
using System.Threading.Tasks;
using AU = Meadow.Units.Angle.UnitType;
namespace ServoTest
{
// Change F7CoreComputeV2 to F7FeatherV2 (or F7FeatherV1) for Feather boards
public class MeadowApp : App<F7CoreComputeV2>
{
Servo servo;
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);
}
}
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
servo = new Servo(Device.Pins.D00);
return base.Initialize();
}
}
}
I tried connecting the servo in the Grove UART port (D00), but it is not working. What PIN should I use? Thanks, in advance.