stripped to something more minimal, with all initializations in place (there were some missing) , and a proper 500 millisec interval timing
(code not tested, give it a try...
// initialize while declaring vars
volatile unsigned long rpmHV = 0;
volatile unsigned long flowHV = 0;
unsigned long lastTime = 0;
#define INTERVAL 500UL
void setup()
{
attachInterrupt(1, rpm_fun, RISING);
attachInterrupt(0, flow_fun, RISING);
Serial.begin(9600);
Serial.println("start...");
}
void loop()
{
unsigned long now = millis(); // to prevent that the next read of millis jumps a few millisecs
if (now - lastTime >= INTERVAL) // every 500 milliseconds
{
lastTime = now;
Serial.print("time: ");
Serial.println(now);
Serial.print("rpmcount: ");
Serial.println(rpmHV * 2 * 60); // rounds per half second => to rounds per minute
Serial.print("flowcount: ");
Serial.println(flowHV); // needs some math too
}
}
void rpm_fun()
{
rpmHV++;
}
void flow_fun()
{
flowHV++;
}