Moin Moin,

ich wollte mich jetzt mal an die Taster heranwagen und hab mir ein tolles Labyrinth aus Büchern gebaut. Der Code den ich geschrieben hab funktioniert allerdings nicht so wie er soll. Er soll eigentlich bei allen Tastern auf der linken seite rechtsherum drehen und bei allen tastern auf der rechten Seite linksherum drehen. Allerdings dreht er sich immer rechtsherum, egal welcher taster gedrückt wurde.
Hier der Code:
Code:
 #include "asuro.h"

int main(void)
{
unsigned char a,b,c;


   Init();
   
   while(1)
   {
	a=PollSwitch();
	b=PollSwitch();
	c=PollSwitch(); 
	
    
	   if ((a==b)&(b==1))
     
    {

        StatusLED (YELLOW);
		MotorDir(RWD,FWD);
		MotorSpeed(150,80);
      
                     
         Msleep(500);
	}	
	
	else if ((a==b)&(b==2))
     
    {

        StatusLED (YELLOW);
         MotorDir(RWD,FWD);
         MotorSpeed(80,80);
                     
         Msleep(500);
	}
	
	else if ((a==b)&(b>=3))
     
    {

        StatusLED (YELLOW);
         MotorDir(RWD,FWD);
         MotorSpeed(80,80);
                     
         Msleep(500);
	}
	
	else if ((a==b)&(b>=6))
     
    {

        StatusLED (YELLOW);
         MotorDir(FWD,RWD);
         MotorSpeed(80,80);
                     
         Msleep(500);
	}
	else if ((a==b)&(b>=12))
     
    {

        StatusLED (YELLOW);
         MotorDir(FWD,RWD);
         MotorSpeed(80,80);
                     
         Msleep(500);
	}
		else if ((a==b)&(b>=20))
     
    {

        StatusLED (YELLOW);
		MotorDir(FWD,RWD);
		MotorSpeed(80,80);
      
                     
         Msleep(500);
	}
		
		
			     
      else
      {
         StatusLED (GREEN);
         MotorDir(FWD,FWD);
         MotorSpeed(120,120);
      }       
   }               
}