um einen Gegenstand herum/ Odometrie
Entschuldigt meine allg. Unwissenheit zu diesem Thema, da ich noch recht neu bin.
Aber nun zu meiner Frage: Mir ist bewusst dass es zu diesem thema schon viele threats gibt, aber die nützen alle nichts (desswegen brauche ich eine privatanpassung von einem netten menschen) : ich habe hier einen prgrammcode, bei dem ich selbst nach mehrmaligem drüberschauen nicht den fehler finden konnte, denn wenn ich ihn ausführe, macht der roboter nicht das was er soll, er fährt nur geradeaus. Der Editor hat scheinbar keinen fehler gebracht.
Code:
#include "asuro.h"
int main(void) {
Init ();
int cm90=16.5;
int s1=10;
int s2=20;
int i, t;
for(i=0;i<10;i++)
{
PollSwitch();
}
t=PollSwitch();
while (1) {
if (t>=1) {
Encoder_Init();
while (encoder[LEFT]<=cm90*3)
{
MotorDir(FWD,FWD);
MotorSpeed(160,0);
}
cm90=0;
MotorDir(BREAK,BREAK);
MotorSpeed(0,0);
while (encoder[LEFT]<=s1*3)
{
MotorDir(FWD,FWD);
MotorSpeed(160,160);
}
MotorDir(BREAK,BREAK);
MotorSpeed(0,0);
cm90=0;
while (encoder[RIGHT]<=cm90*3)
{
MotorDir(FWD,FWD);
MotorSpeed(0,160);
}
MotorDir(BREAK,BREAK);
MotorSpeed(0,0);
cm90=0;
while (encoder[LEFT]<=s2*3)
{
MotorDir(FWD,FWD);
MotorSpeed(160,160);
}
MotorDir(BREAK,BREAK);
MotorSpeed(0,0);
cm90=0;
while (encoder[RIGHT]<=s1*3)
{
MotorDir(FWD,FWD);
MotorSpeed(0,160);
}
MotorDir(BREAK,BREAK);
MotorSpeed(0,0);
cm90=0;
while (encoder[LEFT]<=s1*3)
{
MotorDir(FWD,FWD);
MotorSpeed(160,0);
}
MotorDir(BREAK,BREAK);
MotorSpeed(0,0);
cm90=0;
} else {
MotorDir (FWD,FWD);
MotorSpeed(160,160);
}
}
return 0;
}
DiV RacerD