forked from sharpbrick/powered-up
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExampleCalibrationSteering.cs
32 lines (26 loc) · 1.1 KB
/
ExampleCalibrationSteering.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using SharpBrick.PoweredUp;
using SharpBrick.PoweredUp.Functions;
using static SharpBrick.PoweredUp.Directions;
namespace Example
{
public class ExampleCalibrationSteering : BaseExample
{
public override async Task ExecuteAsync()
{
using (var technicMediumHub = host.FindByType<TechnicMediumHub>())
{
var motor = technicMediumHub.A.GetDevice<TechnicLargeLinearMotor>();
var calibration = serviceProvider.GetService<LinearMidCalibration>();
await calibration.ExecuteAsync(motor);
await Task.Delay(5000);
await motor.GotoAbsolutePositionAsync(CW * 50, 20, 100, SpecialSpeed.Hold, SpeedProfiles.AccelerationProfile);
await Task.Delay(5000);
await motor.GotoAbsolutePositionAsync(CCW * 50, 20, 100, SpecialSpeed.Hold, SpeedProfiles.AccelerationProfile);
await Task.Delay(5000);
await technicMediumHub.SwitchOffAsync();
}
}
}
}