Пример #1
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            _tlc = new Tlc5940("COM3", 1);
            _rgb1 = new RgbLed(_tlc, 1, 2, 3);
            _rgb2 = new RgbLed(_tlc, 4, 5, 6);

            _rgb1.R = 127;
            _rgb1.G = 127;
            _rgb1.B = 127;

            _rgb2.R = 127;
            _rgb2.G = 127;
            _rgb2.B = 127;

            _tlc.Update();
        }
Пример #2
0
        public void WriteShouldWork()
        {
            var mockPort = new Mock<ISerialPortWrapper>(MockBehavior.Strict);
            mockPort.Setup(m => m.Open("COM1"));
            mockPort.Setup(m => m.Write(It.IsAny<byte[]>(), 0, It.IsAny<int>()))
                    .Callback<byte[], int, int>((bytes, offset, length) => Assert.AreEqual(bytes.Length, length));
            mockPort.Setup(m => m.Close());
            mockPort.Setup(m => m.Dispose());

            using (var tlc = new Tlc5940(mockPort.Object, "COM1", 1))
            {
                tlc.SetAll(0xFF);
                tlc.Update();
            }

            mockPort.VerifyAll();
        }