Ejemplo n.º 1
0
        private async void MainPage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            _dispatcher   = CoreWindow.GetForCurrentThread().Dispatcher;
            _blinkyLed    = new BlinkyDriver(blinkyPin);
            _speechDriver = new SpeechDriver();
            await _speechDriver.InitializeAsync();

            _speechDriver.Activated += SpeechDriver_Activated;
            _speechDriver.SpeechCommandTriggered += SpeechCommandTriggered;

            _driver = new TwoMotorsDriver(
                new Motor(leftMotorPin1, leftMotorPin2),
                new Motor(rightMotorPin1, rightMotorPin2));
            await _speechDriver.StartAsync();

            _worker         = new BackgroundWorker();
            _worker.DoWork += DoWork;
            _worker.RunWorkerAsync();
        }
Ejemplo n.º 2
0
        private async void MainPage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            _dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
            _blinkyLed = new BlinkyDriver(blinkyPin);
            _speechDriver = new SpeechDriver();
            await _speechDriver.InitializeAsync();
            _speechDriver.Activated += SpeechDriver_Activated;
            _speechDriver.SpeechCommandTriggered += SpeechCommandTriggered;

            _driver = new TwoMotorsDriver(
                    new Motor(leftMotorPin1, leftMotorPin2),
                    new Motor(rightMotorPin1, rightMotorPin2));
            await _speechDriver.StartAsync();

            _worker = new BackgroundWorker();
            _worker.DoWork += DoWork;
            _worker.RunWorkerAsync();
        }