...it should do - but doesn't. Here's the whole code, but pulsecount does not reset to 0 above 50.
At the moment, I am generating the interrupt with a pull down resistor from interrupt 0 pin to gorund, then supplying 5V to the interrupt pin, each time I do it the pulsecount increments - only sometimes by more than one, I guess due to bounce.
volatile int pulsecount = 0;
void setup()
{
Serial.begin(9600);
attachInterrupt(0, trig, RISING); // din D2
}
void trig()
{
pulsecount++; // adds a count to the variable pulsecount
}
void loop()
{
Serial.println(pulsecount);
delay(500); // wait .5s before updated serial monitor again
if (pulsecount > 50)
{
pulsecount = 0;
}
}