Пример #1
0
 public void Setup()
 {
     _arduino = new Mock<IArduino>(MockBehavior.Strict);
     _timer = new MockedTimer();
     _arduino.Setup(a => a.DigitalWrite(Pin, DigitalPin.Low)).Verifiable();
     _arduino.Setup(a => a.PinMode(Pin, PinMode.Pwm)).Verifiable();
     _led = new LedPwm(_arduino.Object, Pin, _timer);
     _led.Intensity.Should().Equal(0);
 }
Пример #2
0
 private static void LedPwm()
 {
     using (var board = new Arduino.Models.Arduino {Debug = true})
     {
         var led = new LedPwm(board, 9);
         led.Fade(255, 1.Second());
         Thread.Sleep(2.Seconds());
         led.Fade(0, 1.Second());
         led.Off();
     }
 }