public async void Run(IBackgroundTaskInstance taskInstance)
        {
            deferral = taskInstance.GetDeferral();
            taskInstance.Canceled += TaskInstance_Canceled;

            shield = await FEZUtilityShield.CreateAsync().ConfigureAwait(false);

            servo = new Servo(new PCA9685PWMChannel(shield.PCA9685PWM, (int)FEZUtilityShield.PwmPin.P0));
            servo.SetLimits(650, 2750, 0, 180, 90);
            servo.Disengage();

            int i = 130;

            servo.Position = i;
            await Task.Delay(500);

            while (i <= 180)
            {
                servo.Position = i;
                i += 2;
                await Task.Delay(100);
            }

            servo.Disengage();
        }
Exemplo n.º 2
0
 protected override async Task InitializeDefaults()
 {
     servo.SetLimits(650, 2780, 0, 180, 90);
     servo.Disengage();
     await base.InitializeDefaults();
 }