#include <stdlib.h>
#include <asuro.h>
int main()
{
Init();
unsigned spd = 100;
EncoderInit();
EncoderStart();
while(1)
{
StartSwitch();
while(!switched)
{
StatusLED(RED);
FrontLED(ON);
MotorDir(FWD, FWD);
MotorSpeed(spd, spd);
}
while(switched)
{
unsigned t1 = PollSwitch();
unsigned t2 = PollSwitch();
if(t1 && t2 && t1 == t2)
{
if(t2 == K1 || t2 == K2 || t2 == K3)
{
StatusLED(GREEN);
GoTurn(-100, 0, 100);
GoTurn(0, 90, 100);
}
if(t2 == K4 || t2 == K5 || t2 == K6)
{
StatusLED(YELLOW);
GoTurn(-100, 0, 100);
GoTurn(0, -90, 100);
}
/*FrontLED(OFF);
StatusLED(GREEN);
GoTurn(-200, 0, 100);
GoTurn(0, 90, 100);*/
}
switched = FALSE;
}
}
}
Lesezeichen