-9

I'm trying to develop a Windows Phone application that runs a motor. I want to execute the MoveCar method only for 1 second and then Stop.

I have this code that works correctly to move the C motor:

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();
    }

My problem is that I'm missing a code to start MoveCar only for one second. What is the best way to accomplish what I want?

Matthew Strawbridge
  • 19,940
  • 10
  • 72
  • 93
Farik_23
  • 35
  • 4

1 Answers1

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);
T McKeown
  • 12,971
  • 1
  • 25
  • 32