private BidirectionalDcMotor motor;
public override Task Initialize()
{
Resolver.Log.Info("Initializing...");
IDigitalOutputPort motorA;
IDigitalOutputPort motorB;
motorA = Device.Pins.D00.CreateDigitalOutputPort(false);
motorB = Device.Pins.D01.CreateDigitalOutputPort(false);
motor = new BidirectionalDcMotor(motorA, motorB);
return Task.CompletedTask;
}
public override async Task Run()
{
Resolver.Log.Info("Test Motor...");
while (true)
{
motor.StartClockwise();
await Task.Delay(1000);
motor.Stop();
await Task.Delay(500);
motor.StartCounterClockwise();
await Task.Delay(1000);
motor.Stop();
await Task.Delay(500);
}
}