Exemple #1
0
 void _joystickDriver_JoystickMotion(JoystickDriver.Position position, JoystickDriver.Position oldPosition)
 {
     switch (position)
     {
         case JoystickDriver.Position.UP:
             _soundFileSelection++;
             if (_soundFileSelection >= _soundFiles.Length) _soundFileSelection = 0;
             Message("joystick: UP");
             break;
         case JoystickDriver.Position.DOWN:
             _soundFileSelection--;
             if (_soundFileSelection < 0) _soundFileSelection = _soundFiles.Length - 1;
             Message("joystick: DOWN");
             break;
         case JoystickDriver.Position.LEFT:
             _mp3Trigger.Reverse();
             Message("joystick: LEFT");
             break;
         case JoystickDriver.Position.RIGHT:
             _mp3Trigger.Forward();
             Message("joystick: RIGHT");
             break;
     }
 }
Exemple #2
0
        void ProgramStarted()
        {
            Font fontTitle = Resources.GetFont(Resources.FontResources.NinaB);
            Font fontBody = Resources.GetFont(Resources.FontResources.MirB64);
            Font fontStatus = Resources.GetFont(Resources.FontResources.small);
            _oledDriver = new OledDisplayDriver(oledDisplay, fontTitle, fontBody, fontStatus);
            _oledDriver.SetTitle("Hello");
            _oledDriver.SetBody("Foo");

            _joystickDriver = new JoystickDriver(joystick);
            _joystickDriver.JoystickMotion += new JoystickDriver.JoystickMotionHandler(_joystickDriver_JoystickMotion);

            _emic2 = new Emic2(Serial.COM1);
            _emic2.ReadLine += new ThreadedSerialDevice.ReadHandler(_emic2_ReadLine);
            _emic2.Version();

            _mp3Trigger = new Mp3Trigger(Serial.COM2);
            _mp3Trigger.ReadLine += new ThreadedSerialDevice.ReadHandler(_mp3Trigger_ReadLine);
            _mp3Trigger.SetVolume(40);
            _mp3Trigger.StatusVersion();

            button1.ButtonPressed += new Button.ButtonEventHandler(button1_ButtonPressed);
            button1.ButtonReleased += new Button.ButtonEventHandler(button1_ButtonReleased);

            button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
            button.ButtonReleased += new Button.ButtonEventHandler(button_ButtonReleased);

            music.SetVolume(250);
            music.musicFinished += new Music.MusicFinishedPlayingEventHandler(music_musicFinished);

            GT.StorageDevice sd = sdCard.GetStorageDevice();
            _soundFiles = sd.ListFiles("NoAgenda");

            _wiflyThread = new Thread(WiFlyDriver);
            _wiflyThread.Start();
        }