I have problem to get the code working on my new arduino wifi rev2. The code is working on my standard arduino uno but not with the wifi rev2.
I have tried to change the attachedinterrupt to digitalpin but it still dont work.
Can some please look at my code and thell what is wrong.
#include <FlowMeter.h> //
// connect a flow meter to an interrupt pin (see notes on your Arduino model for pin numbers)
FlowMeter Meter1 = FlowMeter(2);
FlowMeter Meter2 = FlowMeter(3);
// set the measurement update period to 1s (1000 ms)
const unsigned long period = 1000;
// define an 'interrupt service handler' (ISR) for every interrupt pin you use
void Meter1ISR() {
// let our flow meter count the pulses
Meter1.count();
}
// define an 'interrupt service handler' (ISR) for every interrupt pin you use
void Meter2ISR() {
// let our flow meter count the pulses
Meter2.count();
}
void setup() {
// prepare serial communication
Serial.begin(9600);
//
//
attachInterrupt(2, Meter1ISR, RISING);
attachInterrupt(3, Meter2ISR, RISING);
Meter1.reset();
Meter2.reset();
}
void loop() {
// wait between output updates
delay(period);
// process the (possibly) counted ticks
Meter1.tick(period);
Meter2.tick(period);
// output some measurement result
Serial.println("M1 " + String(Meter1.getCurrentFlowrate()) + " l/min, " + String(Meter1.getTotalVolume())+ " l total.");
Serial.println("M2 " + String(Meter2.getCurrentFlowrate()) + " l/min, " + String(Meter2.getTotalVolume())+ " l total.");
}
Best regards