Esempio n. 1
0
        static void Main()
        {
            ////////// Set these to match your board //////////////
            var clickRstPin = SC20100.GpioPin.PD4;
            var clickCsPin  = SC20100.GpioPin.PD3;
            var spiBus      = SC20100.SpiBus.Spi3;
            ///////////////////////////////////////////////////////

            var controller = SpiController.FromName(spiBus);
            var ring       = new LedRingClick(controller, clickCsPin, clickRstPin);

            while (true)
            {
                uint fill = 1;
                for (var x = 0; x < 32; x++)
                {
                    ring.ledState += fill;
                    fill         <<= 1;
                    ring.Update();
                    Thread.Sleep(30);
                }

                uint del = 1;
                for (var x = 0; x < 32; x++)
                {
                    ring.ledState -= del;
                    del          <<= 1;
                    ring.Update();
                    Thread.Sleep(30);
                }
            }
        }
Esempio n. 2
0
        static void Main()
        {
            try
            {
                WriteLine("Program started");
                _ledRing = new LedRingClick(Hardware.SocketOne);
                for (Byte i = 0; i <= 32; i++)
                {
                    _ledRing.SetPosition(i);
                    Thread.Sleep(100);
                }
                for (Byte i = 0; i <= 32; i++)
                {
                    _ledRing.SetPosition(i, true);
                    Thread.Sleep(100);
                }
                Demo();
            }

            catch (Exception ex) when(Debugger.IsAttached)
            {
                WriteLine("Exception caught : " + ex.Message);
            }
            catch
            {
                while (true)
                {
                    Hardware.Led3.Write(gpio.GpioPinValue.High ^ Hardware.Led3.Read());
                    Thread.Sleep(100);
                }
            }
            finally
            {
                WriteLine("Entering infinite loop...");
                while (true)
                {
                    Thread.Sleep(100);
                }
            }
        }