more interrupt when using track sensor

First of all, i want to say that i'm from a country notusing english in daily life so i'm sorry for my bad english. I'm having a project at my college in the MCU course. And my teacher want me to make a sumo robot using track sensor to recognize the limit line of the battle yard.

(this is the track sensor that i'm using with my robot)

The problem is that i'm going to use 4 track sensors for my robot with the interrupt of the arduino Uno. But Uno only have 2 interrrupt pins and i'm stuck with how to have more interrupt for my sensor.
Please help me :smiley: thanks alot :smiley:

Why do you think you need interrupts?

because my teacher suggested me to do that.

#define doline 2
#define IN1 5
#define IN2 4
#define IN3 10 
#define IN4 11
  int i;
void setup()
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);

void loop(void)
  if (i == 0)
    digitalWrite(IN1, HIGH);
    digitalWrite(IN2, LOW);
    digitalWrite(IN3, HIGH);
    digitalWrite(IN4, LOW);
  else if (i==1)
    digitalWrite(IN1, LOW);
    digitalWrite(IN2, HIGH);
    digitalWrite(IN3, LOW);
    digitalWrite(IN4, HIGH);
 void chamline (void)
   if (i>1)

this is the code he write an exemple for us. chamline mean when the robot touch the while line.

I hope your teacher told you should qualify "i" as "volatile".

So, all the time that pin 2 is LOW, "i" toggles rapidly between 0 and 1?

More simply:

void loop(void)
    noInterrupts ();
    digitalWrite(IN1, !i);
    digitalWrite(IN2, i);
    digitalWrite(IN3, !);
    digitalWrite(IN4, i);
    interrupts ();

I'm so sorry because I didnt thank you early because i'm very busy :smiley:
About the code that you have post above i'm still not clear about it. Can you post some more example for me :smiley: I'm very appreciate it :smiley: