Example #1
0
        dynamic VolumeTest(dynamic a)
        {
            int vol = (int)a.volume;
            _logger.Debug ("Volume is set to {0}", vol);

            var s = new Speaker(vol);
            s.Beep();
            //s.Buzz();

            return "Hell0w REST client from NancyFX!\r\nVolume @" + vol;
        }
Example #2
0
		public static void Main (string[] args)
		{
			string soundFileName = "/home/root/apps/SoundTest.wav";
			ManualResetEvent terminateProgram = new ManualResetEvent(false);
			var speaker = new Speaker (50);
			ButtonEvents buts = new ButtonEvents ();
			LcdConsole.WriteLine("Up beep");
			LcdConsole.WriteLine("Down buzz");
			LcdConsole.WriteLine("Enter play soundfile");
			LcdConsole.WriteLine("Esc. terminate");
			buts.EscapePressed += () => { 
				terminateProgram.Set();
			};
			buts.UpPressed += () => {
				LcdConsole.WriteLine("Beep");
				speaker.Beep();
			};
			buts.DownPressed += () => { 
				LcdConsole.WriteLine("Buzz");
				speaker.Buzz();
			};
			buts.EnterPressed += () => { 
				LcdConsole.WriteLine("Play sound file");
				try{
					speaker.PlaySoundFile(soundFileName);
				}
				catch(Exception e)
				{
					LcdConsole.WriteLine("Failed to play " + soundFileName);
					LcdConsole.WriteLine("Exception" + e.Message);
					LcdConsole.WriteLine("Stack trace " + e.StackTrace);
					
				
				}
			};   
			terminateProgram.WaitOne();
		}
Example #3
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 public Balanc3R()
 {
     motorR = new Motor(MotorPort.OutA); // 右足
     motorL = new Motor(MotorPort.OutD); // 左足
     speaker = new Speaker(0);
     gyro = new EV3GyroSensor(SensorPort.In2);
     // 角速度を取得
     gyro.Mode = GyroMode.AngularVelocity;
     ir = new EV3IRSensor(SensorPort.In4);
     ir.Mode = IRMode.Remote;
 }
Example #4
0
        public virtual void MakeSound(DogSound sound)
        {
            //TODO: Play sound from file
            this.sound = sound;
            //use enum for picking the right sound file
            string soundFileName = "/home/root/apps/SoundTest.wav";
            //Maybe this directory:  /home/root/lms2012/prjs/Hvalp/Dog sniff.rsf

            var speaker = new Speaker(50);
            try
            {
               // speaker.PlaySoundFile(soundFileName);
                speaker.Beep();
            }
            catch (Exception e)
            {
                LcdConsole.WriteLine("Failed to play " + soundFileName);
                LcdConsole.WriteLine("Exception" + e.Message);
                LcdConsole.WriteLine("Stack trace " + e.StackTrace);
            }

        }