public App()
        {
            _encoder = new RotaryEncoderWithButton(
                N.Pins.GPIO_PIN_D2, N.Pins.GPIO_PIN_D3, N.Pins.GPIO_PIN_D4,
                Netduino.Foundation.CircuitTerminationType.CommonGround);
            _display = new SerialLCD(new TextDisplayConfig()
            {
                Height = 4, Width = 20
            }) as ITextDisplay;

            // set display brightness
            _display.SetBrightness();

            _menu               = new Menu(_display, _encoder, Resources.GetBytes(Resources.BinaryResources.menu));
            _menu.Selected     += HandleMenuSelected;
            _menu.ValueChanged += HandleMenuValueChanged;
        }
Beispiel #2
0
        public App()
        {
            // SETUP CONTROL

            // use encoder with push button
            _encoder = new RotaryEncoderWithButton(
                N.Pins.GPIO_PIN_D7, N.Pins.GPIO_PIN_D6, N.Pins.GPIO_PIN_D5,
                Netduino.Foundation.CircuitTerminationType.CommonGround);

            // use buttons
            //_next = new PushButton(N.Pins.GPIO_PIN_D6, Netduino.Foundation.CircuitTerminationType.CommonGround);
            //_previous = new PushButton(N.Pins.GPIO_PIN_D7, Netduino.Foundation.CircuitTerminationType.CommonGround);
            //_select = new PushButton(N.Pins.GPIO_PIN_D5, Netduino.Foundation.CircuitTerminationType.CommonGround);

            // SETUP DISPLAY

            // GPIO
            _display = new Lcd2004(N.Pins.GPIO_PIN_D13, N.Pins.GPIO_PIN_D12, N.Pins.GPIO_PIN_D11, N.Pins.GPIO_PIN_D10, N.Pins.GPIO_PIN_D9, N.Pins.GPIO_PIN_D8);

            // SERIAL LCD
            //_display = new SerialLCD(new TextDisplayConfig() { Height = 4, Width = 20 }) as ITextDisplay;

            // MCP (i2c)
            //_mcp = new MCP23008();
            //_display = new Lcd2004(_mcp);

            // set display brightness
            _display.SetBrightness();

            // Create menu with encoder
            _menu = new Menu(_display, _encoder, Resources.GetBytes(Resources.BinaryResources.menu), true);

            // Create menu with buttons
            //_menu = new Menu(_display, _next, _previous, _select, Resources.GetBytes(Resources.BinaryResources.menu));

            _menu.Selected     += HandleMenuSelected;
            _menu.ValueChanged += HandleMenuValueChanged;
            _menu.Exited       += HandleMenuExited;

            _menu.Enable();
        }