How can I count the number of times something has "ticked"? [Solved]

Hey guys,

I am working on a project which requires me to count the number of time a certain action has occurred. I have a photoresistor attached to the analog input, and have successfully converted it to volts. However, I need to find some way of determining how many times the voltage has exceeded an arbitrary value since the arduino was last turned on/reset/whatever. I have tried using the ++ increment, but I haven't had much success.

Thanks in advance for the help!

Please read this Read this before posting a programming question ... - Programming Questions - Arduino Forum and post the code you have.

My bad; Here is the relevant section of code

void loop() {
  int pulseCount = analogRead(0);
  float pulseVoltage = pulseCount * (5.0/1023.0);
  int HighCount = 0;
  
  if (pulseVoltage > 4)
  {
    Serial.println("pulse detected");
    Serial.println(++HighCount);
    delay(500);

  }
  else
  {
    Serial.println("no pulse detected");
    delay(500);
  }
}

If I run it right now, I get

pulse detected
1

repeated when I am sending a signal. I also thought about using a bunch of if/then statements but I am even more lost there.

Post ALL the code, not just what you think is relevant.

loop() repeats, so every time you go through it, HighCount starts off as 0. setup() is there to perform one-time initializations, but to take advantage of that, the declaration of HighCount must precede both setup() and loop().

Wow, I didn't even realize that I was resetting the count to zero every time. Thanks for the help!