Hallo,

hatte dieses Problem auch erst. Das liegt daran, dass der Motor scheinbar Störimpulse sendet, so dass das Schaltersignal beeinflusst wird. es lässt sich lösen in dem du:

Code:
unsigned int Sw[5] = {0,0,0,0,0};

Init();
      StatusLED(GREEN);
   while(1)
   {   
      int i=0;
      for(i=0;i<5;i++)
      {
       Sw[i]=PollSwitch();
      }
      if((Sw[1]>0)&&(Sw[2]>0)&&(Sw[3]>0)&&(Sw[0]>0)&&(Sw[4]>0)){   //Wenn Taster, schaun wir mal
         StatusLED(YELLOW);
         if((Sw[1]<8)&&(Sw[2]<8)&&(Sw[3]<8)&&(Sw[0]<8)&&(Sw[4]<8)){ //rechte Seite
            for(y = 0;y < 3;y++){   // drei mal blinken
               BackLED(OFF,ON);
               for(x = 0;x < 180;x++){Sleep(255);}
               BackLED(OFF,OFF);
               for(x = 0;x < 180;x++){Sleep(255);}
               }
               /*
               // Hier ein wenig nach rechts
               MotorDir(FWD,BREAK);
               MotorSpeed(190,0);
               for(x = 0;x < 180;x++){Sleep(255);}
               // Beide Motoren marsch
               MotorDir(FWD,FWD);
               MotorSpeed(190,190);
               */
            StatusLED(GREEN);
            BackLED(OFF,OFF);
            }            
         else if((Sw[1]>4)&&(Sw[2]>4)&&(Sw[3]>4)&&(Sw[0]>4)&&(Sw[4]>4)){ // linke seite
            for(y = 0;y < 3;y++){   // drei mal blinken
               BackLED(ON,OFF);
               for(x = 0;x < 180;x++){Sleep(255);}
               BackLED(OFF,OFF);
               for(x = 0;x < 180;x++){Sleep(255);}
               }
               /*
               // und ein wenig nach links
               MotorDir(BREAK,FWD);
               MotorSpeed(0,190);
               for(x = 0;x < 180;x++){Sleep(255);}
               // und geradeaus
               MotorDir(FWD,FWD);
               MotorSpeed(190,190);
               */
            // Blinker aus
            StatusLED(GREEN);
            BackLED(OFF,OFF);
            }
         } 
       else{
        }
         StatusLED(GREEN);
         BackLED(OFF,OFF);
         Sw = 0;
   }
   return 0;
   //return 0;
}