How can i count value with arduino

Hi guys,

How can I count the 'high value' received for 10 seconds

Of what?

How can I count the 'high value' received for 10 seconds

unsigned long startCounting = millis();
int count = 0;

while(millis() - startCounting <= 10000)
{
    if(checkSomeMysteriousCondition())
    {
       count++;
    }
}
Serial.print("Something happened ");
Serial.print(count);
Serial.println(" times in 10 seconds");

All you need to do is write the checkSomeMysteriousCondition() function.

@PaulS what is the aim of count++ ?

Maker_Boy:
@PaulS what is the aim of count++ ?

It would have been better written as count ++ so that it was clear that there is a variable named count and an operator called ++. The ++ operator increments the value in a variable.

...R

I'm thinking perhaps the meaning is: "How can I record the highest value detected in the last ten seconds?"

But, I could be wrong.

dougp:
I'm thinking perhaps the meaning is: "How can I record the highest value detected in the last ten seconds?"

But, I could be wrong.

Well, we'd still need to know where the values are coming from.