so hab mal probiert ein programm zu schreiben aber es klappt irgendwie nicht so richtig kann mir mal eben wer helfen wenns am asuro ist wartet er dann nämlich nicht
Code:
#include "asuro.h" // NoHit
int main(void)
{
char message[]="Asuro starting NoHit\n";
char message1[]=".";
char message2[]="R";
char message3[]="L";
char message4[]="B";
Init();
MotorDir(FWD,FWD);
MotorSpeed(255,255);
FrontLED(ON);
SerWrite(message,sizeof(message));
while(1)
{
if(PollSwitch()==0)
{
MotorDir(FWD,FWD);
MotorSpeed(255,255);
BackLED(ON,ON);
StatusLED(GREEN);
SerWrite(message1,sizeof(message1));
}
else
{
if(PollSwitch()<=7)
{
MotorDir(RWD,FWD);
MotorSpeed(255,255);
StatusLED(YELLOW);
BackLED(OFF,ON);
SerWrite(message2,sizeof(message2));
Sleep(72*5000);
}
else if(PollSwitch()==8||PollSwitch()==16||PollSwitch()==32)
{
MotorDir(FWD,RWD);
MotorSpeed(255,255);
StatusLED(YELLOW);
BackLED(ON,OFF);
SerWrite(message3,sizeof(message3));
Sleep(72*5000);
}
else
{
MotorDir(RWD,RWD);
MotorSpeed(255,255);
StatusLED(RED);
BackLED(OFF,OFF);
SerWrite(message4,sizeof(message4));
Sleep(72*5000);
}
}
}
}
EDIT V0.2 klappt auch ned :
Code:
#include "asuro.h" // NoHit
int main(void)
{
char message[]="Asuro starting NoHit\n";
char message1[]=".";
char message2[]="R";
char message3[]="L";
char message4[]="B";
int sleep;
Init();
MotorDir(FWD,FWD);
MotorSpeed(255,255);
FrontLED(ON);
SerWrite(message,sizeof(message));
while(1)
{
if(PollSwitch()==0)
{
MotorDir(FWD,FWD);
MotorSpeed(255,255);
BackLED(ON,ON);
StatusLED(GREEN);
SerWrite(message1,sizeof(message1));
}
else
{
if(PollSwitch()<=7)
{
MotorDir(RWD,FWD);
MotorSpeed(255,255);
StatusLED(YELLOW);
BackLED(OFF,ON);
SerWrite(message2,sizeof(message2));
for(sleep=0;sleep<2000;sleep++)
Sleep(72);
}
else if(PollSwitch()==8||PollSwitch()==16||PollSwitch()==32)
{
MotorDir(FWD,RWD);
MotorSpeed(255,255);
StatusLED(YELLOW);
BackLED(ON,OFF);
SerWrite(message3,sizeof(message3));
for(sleep=0;sleep<2000;sleep++)
Sleep(72);
}
else
{
MotorDir(RWD,RWD);
MotorSpeed(255,255);
StatusLED(RED);
BackLED(OFF,OFF);
SerWrite(message4,sizeof(message4));
for(sleep=0;sleep<2000;sleep++)
Sleep(72);
}
}
}
}
Lesezeichen