Also ich hab weiterhin nicht die logische verknüpfung && sondern einfach nur & verwendet frag mich nicht wieso aber es geht. Hier mein jetziges Programm:
Code:
#include "asuro.h"
int main(void)
{
unsigned char a,b;
Init();
while(1)
{
a=PollSwitch();
b=PollSwitch();
if ((a==b)&(b==1))
{
StatusLED (RED);
BackLED(OFF,ON);
FrontLED(ON);
MotorDir(RWD,RWD);
MotorSpeed(100,100);
Msleep(350);
FrontLED(OFF);
BackLED(OFF,OFF);
StatusLED(YELLOW);
MotorDir(RWD,FWD);
MotorSpeed(100,100);
Msleep(500);
}
else if ((a==b)&(b==2))
{
StatusLED (RED);
BackLED(OFF,ON);
FrontLED(ON);
MotorDir(RWD,RWD);
MotorSpeed(100,100);
Msleep(350);
FrontLED(OFF);
BackLED(OFF,OFF);
StatusLED(YELLOW);
MotorDir(RWD,FWD);
MotorSpeed(100,100);
Msleep(500);
}
else if ((a==b)&(b==4))
{
StatusLED (RED);
BackLED(OFF,ON);
FrontLED(ON);
MotorDir(RWD,RWD);
MotorSpeed(100,100);
Msleep(350);
FrontLED(OFF);
BackLED(OFF,OFF);
StatusLED(YELLOW);
MotorDir(RWD,FWD);
MotorSpeed(100,100);
Msleep(500);
}
else if ((a==b)&(b==8))
{
StatusLED (RED);
BackLED(ON,OFF);
FrontLED(ON);
MotorDir(RWD,RWD);
MotorSpeed(100,100);
Msleep(350);
FrontLED(OFF);
BackLED(OFF,OFF);
StatusLED(YELLOW);
MotorDir(FWD,RWD);
MotorSpeed(100,100);
Msleep(500);
}
else if ((a==b)&(b==16))
{
StatusLED (RED);
BackLED(ON,OFF);
FrontLED(ON);
MotorDir(RWD,RWD);
MotorSpeed(100,100);
Msleep(350);
FrontLED(OFF);
BackLED(OFF,OFF);
StatusLED(YELLOW);
MotorDir(FWD,RWD);
MotorSpeed(100,100);
Msleep(500);
}
else if ((a==b)&(b>=25))
{
StatusLED (RED);
BackLED(ON,OFF);
FrontLED(ON);
MotorDir(RWD,RWD);
MotorSpeed(100,100);
Msleep(350);
FrontLED(OFF);
BackLED(OFF,OFF);
StatusLED(YELLOW);
MotorDir(FWD,RWD);
MotorSpeed(100,100);
Msleep(500);
}
else
{
BackLED(OFF,OFF);
FrontLED(OFF);
StatusLED (GREEN);
MotorDir(FWD,FWD);
MotorSpeed(120,120);
}
}
}
mfg
Erik
Lesezeichen