Esempio n. 1
0
 private void SwitchStateChangedRunAroundObstacles(object sender, SwitchEventArgs e)
 {
     if (e.SwitchEnabled)
     {
         if (ActualDriveTask != null)
         {
             this.ActualDriveTask.Stop();
         }
         RunAroundObstacles drvTask = new RunAroundObstacles();
         drvTask.DoorFoundEvent += new RunAroundObstacles.DoorFoundEventHandler(drvTask_DoorFoundEvent);
         drvTask.FinishedEvent += new RunAroundObstacles.FinishedEventHandler(drvTask_FinishedEvent);
         drvTask.StartedEvent += new RunAroundObstacles.StartedEventHandler(drvTask_StartedEvent);
         this.ActualDriveTask = drvTask;
         this.ActualDriveTask.Go();
     }
     else
     {
         if (this.ActualDriveTask != null)
         {
             this.ActualDriveTask.Stop();
         }
     }
 }
Esempio n. 2
0
        void drvTask_DoorFoundEvent(object sender, RunAroundObstacles.DoorFoundEventArgs e)
        {
            //disable all blinking LEDS 2-3
            RobotConsole[BlinkingLeds.BlinkingLed1].LedEnabled = false;
            RobotConsole[BlinkingLeds.BlinkingLed2].LedEnabled = false;
            RobotConsole[BlinkingLeds.BlinkingLed3].LedEnabled = false;

            //Enable correct LED
            RobotConsole[(BlinkingLeds)(3-e.FoundDoor)].LedEnabled = true;
        }