So jetzt hab ich noch eine Modifikation gemacht, doch das If wird bei Kollision trotzdem nicht ausgeführt. Fahren tut er brav!
Code:
#include "asuro.h"
int i;
int main(void)
{
Init();
if (PollSwitch()==0 && PollSwitch()==0 && PollSwitch()==0 && PollSwitch()==0)
{
MotorDir(FWD,FWD);
MotorSpeed(200,200);
BackLED(ON,ON);
}
if (PollSwitch()!=0 && PollSwitch()!=0 && PollSwitch()!=0 && PollSwitch()!=0)
{
MotorDir(BREAK,BREAK);
MotorSpeed(0,0);
StatusLED(RED);
MotorDir(FWD,BREAK);
MotorSpeed(100,0);
StatusLED(GREEN);
}
while(1);
return(0);
}
Lesezeichen