How can i display the ir value for each time it go high independently?

#include <Servo.h>
int LED = 13;
//int isObstaclePin = 7;
//int isObstacle = HIGH;
int ir = 7;
int ir1 = 8;
int count = 0;
int count1 = 0;
Servo servo;

void setup() {
pinMode(LED, OUTPUT);
pinMode(7, INPUT);
servo.attach(3);
Serial.begin(9600);

}

void loop() {

servo.write(180);
delay(200);
servo.write(0);
delay(200);

if (digitalRead(ir) == 1){

while (digitalRead(ir) == 1 )
{};
count = count + 1;
Serial.println("Number 3mm: ");
//Serial.print(“S”);
Serial.println(count);
delay(50);
if (count > 9)
{
Serial.println(“The box is full. Remove the drill bits”);
delay(5000);
}
else
{
}

}

if (digitalRead(ir1) == 1){

while (digitalRead(ir1) == 1)
{};
count1 = count1 + 1;
Serial.println("Number 6mm: ");
//Serial.print(“S”);
Serial.println(count1);
delay(50);
if (count1 > 9)
{
Serial.println(“The box is full. Remove the drill bits”);
delay(5000);
}
else
{
}

}

}

You could use the technique shown in the state change detection tutorial to sense the transition from low to high.

Read the how to use this forum-please read sticky to see how to properly post code.

Use auto format to indent your code for better readability. Remove unnecessary white space. One blank line between sections of code is OK, any more just wastes space.