我正在尝试开发运行电机的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
一秒钟。什么是实现我想要的最佳方式?
答案 0 :(得分: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);