Fahren jetzt noch feiner:
Code:
/* fahrenfeiner3 */
#include "asuro.h"
int back(void){
int i;
StatusLED(RED);
BackLED(ON,ON);
MotorDir(RWD,RWD);
MotorSpeed(200,202);
for(i=0;i<=270;i++){
Sleep(255);
}
}
int taster(void){
if(PollSwitch() > 0 && PollSwitch() < 8)
return 0;
else if(PollSwitch() > 7 && PollSwitch() < 60 && PollSwitch() != 12 && PollSwitch() != 18 && PollSwitch() != 30)
return 1;
else if(PollSwitch() == 12 || PollSwitch() == 18 || PollSwitch() == 30)
return 2;
}
int main(void){
int j;
Init();
while(1){
if(PollSwitch() != 0){
taster();
taster();
taster();
switch(taster()){
case 0:
back();
StatusLED(YELLOW);
BackLED(ON,OFF);
MotorDir(RWD,FWD);
MotorSpeed(150,150);
for(j=0;j<=120;j++){
Sleep(255);
}
break;
case 1:
back();
StatusLED(YELLOW);
BackLED(OFF,ON);
MotorDir(FWD,RWD);
MotorSpeed(150,150);
for(j=0;j<=120;j++){
Sleep(255);
}
break;
case 2:
back();
StatusLED(YELLOW);
BackLED(ON,ON);
MotorDir(RWD,FWD);
MotorSpeed(152,150);
for(j=0;j<=200;j++){
Sleep(255);
}
break;
}
}
else{
StatusLED(GREEN);
BackLED(OFF,OFF);
MotorDir(FWD,FWD);
MotorSpeed(150,150);
}
}
return 0;
}
So und jetzt werd ich das mal alles ausbauen.
Schönen Abend
Lesezeichen