Beispiel #1
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            _GpioController = GpioController.GetDefault();
            _resetEvent = new ManualResetEvent(false);

            if (this._GpioController != null)
            {

                using (GpioPin data = _GpioController.OpenPin(17))
                using (GpioPin clock = _GpioController.OpenPin(27))
                using (GpioPin strobe = _GpioController.OpenPin(22))
                {
                    data.SetDriveMode(GpioPinDriveMode.Output);
                    clock.SetDriveMode(GpioPinDriveMode.Output);
                    strobe.SetDriveMode(GpioPinDriveMode.Output);

                    var display = new TM1638(data, clock, strobe, true, 1);
                    display.setLED(TM1638.TM1638_LED_COLOR.GREEN, 0);
                    display.setLED(TM1638.TM1638_LED_COLOR.RED, 1);
                    display.setLED(TM1638.TM1638_LED_COLOR.ORANGE, 2);
                }
            }
        }
Beispiel #2
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            _GpioController = GpioController.GetDefault();
            _resetEvent = new ManualResetEvent(false);

            if (this._GpioController != null)
            {

                using (GpioPin data = _GpioController.OpenPin(17))
                using (GpioPin clock = _GpioController.OpenPin(27))
                using (GpioPin strobe = _GpioController.OpenPin(22))
                {
                    data.SetDriveMode(GpioPinDriveMode.Output);
                    clock.SetDriveMode(GpioPinDriveMode.Output);
                    strobe.SetDriveMode(GpioPinDriveMode.Output);

                    var display = new TM1638(data, clock, strobe, true, 1);
                    display.setDisplayToString("COUCOU !", 0, 0);

                    for (byte i = 0; i < 8; i++)
                    {
                        Task.Delay(500 / 2).Wait();

                        display.setLED(TM1638.TM1638_LED_COLOR.RED, i);

                        Task.Delay(500 / 2).Wait();

                        display.setLED(TM1638.TM1638_LED_COLOR.GREEN, i);

                    }

                    Task.Delay(3000 / 2).Wait();

                    display.setDisplayToString("BISOUS! ", 0, 0);

                    Task.Delay(3000 / 2).Wait();

                    for (int i = 0; i < 360; i++)
                    {
                        display.setDisplayToString(String.Format("4    {0}", i.ToString().PadRight(3, ' ')), 0, 0);
                    }

                    Task.Delay(3000 / 2).Wait();

                    //ClearLED
                    for (byte i = 0; i < 8; i++)
                    {
                        display.setLED(TM1638.TM1638_LED_COLOR.OFF, i);
                    }

                    display.clearDisplay();
                }
            }
        }
Beispiel #3
0
        private void clear_Click(object sender, RoutedEventArgs e)
        {
            _GpioController = GpioController.GetDefault();
            _resetEvent = new ManualResetEvent(false);

            if (this._GpioController != null)
            {

                using (GpioPin data = _GpioController.OpenPin(17))
                using (GpioPin clock = _GpioController.OpenPin(27))
                using (GpioPin strobe = _GpioController.OpenPin(22))
                {
                    data.SetDriveMode(GpioPinDriveMode.Output);
                    clock.SetDriveMode(GpioPinDriveMode.Output);
                    strobe.SetDriveMode(GpioPinDriveMode.Output);

                    var display = new TM1638(data, clock, strobe, true, 1);
                    //ClearLED
                    for (byte i = 0; i < 8; i++)
                    {
                        display.setLED(TM1638.TM1638_LED_COLOR.OFF, i);
                    }

                    display.clearDisplay();

                }

            }
        }