Peak counting in serial Arduino
keep in mind that since you used

delay(100)


your 'loop' code runs in 10HZ (10 times a second)
So, every time you are lighting on your sensor, if its for longer than 1/10 of a second, you are likely going through several instances of 'loop', in which the condition

(val&gt;700)


is satisfied.

If you know that your peaks are going to take several loops, and only want to count each peak once- a simple way would be to make sure you dropped from the previous peak before incrementing the counter. you can achieve that with something like:

int count=0;
int val;
int data;
bool inPeak = false;

void setup() {
  Serial.begin(115200);
}

void loop() {
  data=analogRead(A0);
  val=map(data,0,1023,1000,0);
  if(val&gt;700) {
     if (!inPeak)
     {
        count ++;
        inPeak = true;    
     }  
  }
  else 
  {
      inPeak = false;
  }

  Serial.println(count);
  delay(100);
}