-9

我正在尝试开发一个运行电机的 Windows Phone 应用程序。我只想执行该MoveCar方法 1 秒钟,然后Stop.

我有这个代码可以正确移动 C 电机:

CarControl _cc;    
private void UP_Motor_C(object sender, RoutedEventArgs e)
    {
        _cc.Turn = 50; //the C motor will start running in 50% speed
        _cc.LeftSpeed = 0; //the B motor will stop working
        _cc.RightSpeed = 0; //the A motor will stop working

        _cc.MoveCar();
    }

我的问题是我缺少一个MoveCar只能启动一秒钟的代码。实现我想要的最好方法是什么?

4

1 回答 1

1
    _cc.Turn = 50; //the C motor will start running in 50% speed

    _cc.LeftSpeed = 0; //the B motor will stop working
    _cc.RightSpeed = 0; //the A motor will stop working

    _cc.MoveCar();

    System.Threading.Thread.Current.Sleep(1000);
于 2014-06-16T19:35:45.303 回答