hallo, mein asuro fährt scheinbar willkürlich. ich glaube es liegt am code.
er soll, wie im bild beschrieben, erst gerade aus gegen eine wand fahren, dann einen 180° bogen rückwärts machen und dann wieder geradeaus gegen die nächste wand fahren. dann anhalten und aufhören.

ps: die odometrie geht nicht. beim bogen kommt es nicht auf genauigkeit an. ist erstmal nur grob.


Code:
#include <stdlib.h>
#include "asuro.h" 
#define taste (!(PINC & (1<<PC4))) // Tastenabfrage 
#define keine_taste (PINC & (1<<PC4))

void MSleep (int dauer)
{
  int z;
  for (z = 0; z < dauer; z++)
    Sleep (36);
}


int main(void){ 
int i=0;
Init(); 
while(1) { 

  while (keine_taste) {
    StatusLED(RED); 
    BackLED(OFF,OFF); 
    MotorDir(FWD,FWD); 
    MotorSpeed(120,152); 
  }    
  if (PollSwitch()>0){   
    while (i<30) { 
      BackLED(ON,ON); 
      MotorDir(RWD,RWD); 
      MotorSpeed(120,152); 
	  i++;
	  MSleep(36);
    }   
    MotorSpeed(0,0); 
    i=0;
    while (i<250) {
      MotorDir(RWD,RWD); 
      MotorSpeed(120,0); 
	  i++;
	  MSleep(36);
    }     
    BackLED(OFF,OFF); 
    MotorDir(FWD,FWD);
	MotorSpeed(120,152); 
    i=0;
    StatusLED(YELLOW);
	if (PollSwitch()>0){
	  StatusLED(GREEN);
	  MotorSpeed(0,0);
	  while (1){
	    MotorSpeed(0,0);
	  }
	}
	
  } 
  
} 

}
http://www.picupload.net/s-8c871b060...4fbc54-jpg.php