Also ich hab daran nochmal rumgearbeitet bis mir der Compiler keinen Fehler mehr ausgespuckt hat, allerdings bin ich mir nicht sicher ob das funktionieren wird und will das jetzt auch nicht flashen, bevor ich nicht weiß, dass das funktionieren wird. Denn im Moment ist ja noch das Programm drauf das funktioniert. Da muss ich nur noch die Radien versuchen zu verbessern, aber da hab ich auch schon eine Idee.
Da wäre dann der Code von dem Programm, wie ich es im Moment habe:
# include <asuro.h>
void sleep_ms(int ms){
while(ms>0){
Sleep(72);
ms=ms--;
}
}
void rechts_daneben (void){
BackLED(OFF,ON);
MotorSpeed(0,120);
sleep_ms(1000);
//MotorSpeed (120,120);
BackLED(OFF,OFF);
}
void links_daneben (void){
BackLED(ON,OFF);
MotorSpeed(120,0);
sleep_ms(1000);
//MotorSpeed(120,120);
BackLED(OFF,OFF);
}
void main (void){
unsigned int data [2];
Init();
MotorDir(RWD,RWD);
MotorSpeed(120,120);
FrontLED(ON);
while(1){
LineData(data);
if (data[0]!=data[1]){
if (data[0]>data[1]){
rechts_daneben();
}
else /*(data[0]<data[1])*/{
links_daneben();
}
}
else{
MotorDir(RWD,RWD);
MotorSpeed(120,120);
BackLED(OFF,OFF);
}
LineData(data);
}
}
Lesezeichen