Beispiel #1
0
 public ServoMotor(IPwmController pwmController, byte id)
 {
     this.pwmController = pwmController;
     this.id            = id;
     Console.WriteLine($"Min: {servoMin}");
     Console.WriteLine($"Max: {servoMax}");
 }
Beispiel #2
0
 internal PwmChannel(IPwmController controller, uint channel, uint period, uint duration)
 {
     _channel    = channel;
     _period     = period;
     _duration   = duration;
     _controller = controller;
     Commit();
 }
Beispiel #3
0
 internal PwmChannel(IPwmController controller, uint channel, float dutyCycle)
 {
     if (dutyCycle < 0.0 || dutyCycle > 1.0)
     {
         throw new ArgumentOutOfRangeException("dutyCycle", "must be a fraction of unity");
     }
     _channel    = channel;
     _controller = controller;
     _dutyCycle  = dutyCycle;
     Commit();
 }
Beispiel #4
0
 internal PwmChannel(IPwmController controller, uint channel, uint period, uint duration, ScaleFactor scale)
 {
     this.channel    = channel;
     this.period     = period;
     this.duration   = duration;
     this.scale      = scale;
     this.controller = controller;
     try
     {
         AllocateChannel(channel);
         Init();
         Commit();
     }
     catch
     {
         Dispose(false);
     }
 }
Beispiel #5
0
        private async Task FadeInFadeOutAsync(IPwmController controller, GpioEnum gpio)
        {
            var led = new DimmableLed(controller, gpio, 10);

            while (true)
            {
                for (int i = 10; i <= 90; i += 4)
                {
                    led.Dim(i, this);
                    await Task.Delay(10);
                }
                for (int i = 90; i >= 10; i -= 4)
                {
                    led.Dim(i, this);
                    await Task.Delay(50);
                }
            }
        }
Beispiel #6
0
 internal PwmChannel(IPwmController controller, uint channel, double dutyCycle)
 {
     if (dutyCycle < 0.0 || dutyCycle > 1.0)
     {
         throw new ArgumentOutOfRangeException("dutyCycle", "must be a fraction of unity");
     }
     this.channel    = channel;
     this.controller = controller;
     this.dutyCycle  = dutyCycle;
     try
     {
         Init();
         Commit();
     }
     catch
     {
         Dispose(false);
     }
 }
Beispiel #7
0
 public DimmableLed(IPwmController controller, GpioEnum gpio, int initialValue)
 {
     Pin = controller.OpenPin(gpio);
     Pin.Start();
     Dim(initialValue, this);
 }
 public SpeedController(IPwmController pwm)
 {
     _pwm = pwm;
 }
Beispiel #9
0
 public GateController(ISelector selector, IPwmController pwmController, IGateStates gateStates)
 {
     _selector      = selector;
     _pwmController = pwmController;
     _gateStates    = gateStates;
 }