wallhard.ic

void Wallhard(){

  
  int pid1;
  
  // Espera precionar start antes de comecar
  sleep(0.5);
  printf ("\nSeguir Parede");
  while(!start_button());
  sleep(0.5);
  
  pid1 = start_process(WallFollow1());
  
  while(!stop_button());
  kill_process(pid1);
  ao();    

}

void WallFollow1(){

  
  int sensor;
  int estado = ESQ;
  
  LEFT_POWER = 30;
  RIGHT_POWER = 30;
  
  // Define o estado inicial
  VirarEsq1();
  estado = ESQ;
  
  while (1){
      
      sensor = analog(SENSOR);
      
      if (sensor < perto){
          VirarDir1();
      }
      else{
          VirarEsq1();
          
      }
      
      
  }

}

Vira para direita void VirarDir1(){ motor (LEFT_MOTOR, (int)1); motor (RIGHT_MOTOR, 0); } Vira para esquerda void VirarEsq1(){

  motor (LEFT_MOTOR, 0);
  motor (RIGHT_MOTOR, (int)((float)RIGHT_POWER));

}

1) float)LEFT_POWER