Testing with 1 flowmeter. ok
Testing with 2 flowmeters. It's not ok.
I am working in a beer heat exchanger prototype. that flowmeters are going to show the mass velocity (L/min.) that goes into each channel (wort and water).
 //This is the function that the interupt calls
{
NbTopsFan1++; //This function measures the rising and falling edge of the hall effect sensors signal
NbTopsFan2++;
}
// The setup() method runs once, when the sketch starts
void setup() //
{
pinMode(hallsensor1, INPUT); //initializes digital pin 2 as an input
pinMode(hallsensor2, INPUT);
Serial.begin(9600); //This is the setup function where the serial port is initialised,
attachInterrupt(0, rpm, RISING); //and the interrupt is attached
attachInterrupt(1, rpm, RISING);
}
// the loop() method runs over and over again,
// as long as the Arduino has power
void loop ()
{
NbTopsFan1 = 0; //Set NbTops to 0 ready for calculations
NbTopsFan2 = 0;
sei(); //Enables interrupts
delay (1000); //Wait 1 second
cli(); //Disable interrupts
Calc = (NbTopsFan1 * 7.50 / 60.00); //(Pulse frequency x 60) / 7.5Q, = flow rate in L/hour
Vazao = (NbTopsFan2 * 7.5 / 60.00 );
Serial.print (Calc, 5); //Prints the number calculated above
Serial.print (" L/min"); //Prints "L/hour" and returns a new line
Serial.print (" ");
Serial.print (Vazao, 5);
Serial.print (" L/min");
Serial.println ();
So, I can't figure out why each flowmeter gives its response in both columns.))