FĂ©v 282015

This is the last article about my water impulse counter project.
3 previous articles can be found here .

The last issue I encountered was about electro magnetic disturbances (probably my gaz heater nearby).
I initially planned to detect FALLING impulses (high to low, low meaning the reed switch is closed).
But about 4 times per hour, i detected a falling impulse, and this even the water circuit closed !

I therefore decided to review my code in the interrupt function now based on a CHANGE event (no more FALLING).

void IntChange() {
if (digitalRead(SWITCHPIN)==LOW) {
} else {
if (start>0) {
} else {
}//if (start>0)
} //if (digitalRead(SWITCHPIN)==LOW) {

And this proves to work perfectly now 🙂
See graph below.

The whole code can be found here.
it includes a web server (for my domotic box to query), a sd card reader (to store the counter value between power off), an interrupt handler.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>