Exemplo n.º 1
0
        public static void Main()
        {
            // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            // !   W A R N I N G    W A R N I N G     W A R N I N G     W A R N I N G    W A R N I N G   !
            // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            // ! There are a lot of different keypads with different pin sets.                           !
            // ! See http://netmftoolbox.codeplex.com/wikipage?title=Toolbox.NETMF.Hardware.MatrixKeyPad !
            // ! for more about these keypads.                                                           !
            // ! The pins used below probably won't work on your specific keypad.                        !
            // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

            // Row pins. The keypad exists out of 4 rows.
            Cpu.Pin[] RowPins = { Pins.GPIO_PIN_D4, Pins.GPIO_PIN_D5, Pins.GPIO_PIN_D6, Pins.GPIO_PIN_D7 };
            // Col pins. The keypad exists out of 3 columns.
            Cpu.Pin[] ColPins = { Pins.GPIO_PIN_D1, Pins.GPIO_PIN_D2, Pins.GPIO_PIN_D3 };
            // Initializes the new keypad
            MatrixKeyPad kb = new MatrixKeyPad(RowPins, ColPins);

            // Bind both events
            kb.OnKeyDown += new NativeEventHandler(kb_OnKeyDown);
            kb.OnKeyUp   += new NativeEventHandler(kb_OnKeyUp);

            // Lets wait forever for events to occure
            Thread.Sleep(Timeout.Infinite);
        }
Exemplo n.º 2
0
        /// <summary>
        /// This is the method that runs when we turn it on
        /// </summary>
        public static void Main()
        {
            // Set up the pins we are plugging in to
            Cpu.Pin[] RowPins = { Pins.GPIO_PIN_D7, Pins.GPIO_PIN_D6, Pins.GPIO_PIN_D5, Pins.GPIO_PIN_D4 };
            Cpu.Pin[] ColPins = { Pins.GPIO_PIN_D3, Pins.GPIO_PIN_D2, Pins.GPIO_PIN_D1 };

            // Turn on the key pad
            keyPad = new MatrixKeyPad(RowPins, ColPins);

            // Listen for when a button is pushed
            keyPad.OnKeyUp += keyPad_OnKeyUp;

            // Always lock when power is turned on
            LockTheBox();

            while (true)
            {
            }
        }