Code:
//Dieses Programm dient zum geradeausfahren
//zusammengestellt und umgeschrieben von julien 

#include "asuro.h" 

int main(void) 
{ 
    unsigned int Rmin = 1024, Rmax = 0, Lmin = 1024, Lmax = 0, Rmitte = 512, Lmitte = 512, lspeed=150, rspeed=150, data[2];
    unsigned int wegr=0, wegl=0; 
   unsigned char flagl=FALSE, flagr=FALSE; 
    Init(); 
    MotorDir(FWD,FWD); 
    while(1) { 
     MotorSpeed(lspeed,rspeed);
        OdometrieData(data); // 0. links, 1. rechts       
        // max links 
        if (data[0] > Lmax) 
            Lmax += (data[0] - Lmax) / 2; 
        // min links 
        if (data[0] < Lmin) 
            Lmin -= (Lmin - data[0]) / 2; 
        // max rechts 
        if (data[1] > Rmax) 
            Rmax += (data[1] - Rmax) / 2; 
        // min rechts 
        if (data[1] < Rmin) 
            Rmin -= (Rmin - data[1]) / 2; 
    Rmitte=(Rmax+Rmin)/2; 
    Lmitte=(Lmin+Lmax)/2; 
      if ((data[0] < Lmitte) && (flagl == TRUE)) { 
      flagl = FALSE; 
      wegl++; 
      } 
      if ((data[0] > Lmitte) && (flagl == FALSE)) { 
      flagl = TRUE; 
      wegl++; 
      } 
      if ((data[1] < Rmitte) && (flagr == TRUE)) { 
      flagr = FALSE; 
      wegr++; 
      } 
      if ((data[1] > Rmitte) && (flagr == FALSE)) { 
      flagr = TRUE; 
      wegr++; 
      } 
     if(wegr>wegl){
      if(lspeed<=254) lspeed++ else rspeed--;
     }
     if(wegr<wegl){
      if(rspeed<=254) rspeed++ else lspeed--;
     }
     SerWrite("WL: ",4); 
     PrintInt(wegl); //Ausgabe Weg linkes Rad 
     SerWrite("WR: ",4); 
     PrintInt(wegr); //Ausgabe Weg rechtes Rad); 
     SerWrite("/r/n",2); 
   } 
    return 0; 
}
So, das dürfte ziemlich genau laufen. Egal, wie das Umgebungslicht ist.
MfG julien