Esempio n. 1
0
        void Initialize()
        {
            var onboardLed = new RgbPwmLed(
                device: Device,
                redPwmPin: Device.Pins.OnboardLedRed,
                greenPwmPin: Device.Pins.OnboardLedGreen,
                bluePwmPin: Device.Pins.OnboardLedBlue);

            onboardLed.SetColor(Color.Red);

            notes = new float[] { 261.63f, 329.63f, 392, 523.25f };

            game = new SimonGame();

            leds    = new PwmLed[4];
            leds[0] = new PwmLed(Device, Device.Pins.D10, TypicalForwardVoltage.Red);
            leds[1] = new PwmLed(Device, Device.Pins.D09, TypicalForwardVoltage.Green);
            leds[2] = new PwmLed(Device, Device.Pins.D08, TypicalForwardVoltage.Blue);
            leds[3] = new PwmLed(Device, Device.Pins.D07, TypicalForwardVoltage.Yellow);

            buttons             = new PushButton[4];
            buttons[0]          = new PushButton(Device, Device.Pins.MISO);
            buttons[0].Clicked += ButtonRedClicked;
            buttons[1]          = new PushButton(Device, Device.Pins.D02);
            buttons[1].Clicked += ButtonGreenClicked;
            buttons[2]          = new PushButton(Device, Device.Pins.D03);
            buttons[2].Clicked += ButtonBlueClicked;
            buttons[3]          = new PushButton(Device, Device.Pins.D04);
            buttons[3].Clicked += ButtonYellowClicked;

            speaker = new PiezoSpeaker(Device, Device.Pins.D12);

            onboardLed.SetColor(Color.Green);
        }