[help] line follower

Question: "Why is the robot moving around in circles?
Answer: "I don't know, let's ask the robot"

Start putting some debug prints into your code

   switch (results.value)
   {
   case 0x506A9BC7 : 
   ir=0; //stop
  Serial.println (F("Stop"));
   break;
   case 0xDBCB3A41 : 
   ir=1; //start
   Serial.println (F("Start"));
   break;
   }
   irrecv.resume(); // Receive the next value
   }*/
  //if (ir) {

. . .and so on.