Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, a web toolkit designed to help citizens, conservation practitioners, municipal decision-makers, researchers, educators, and students advance knowledge and stewardship of fresh water. New to EnviroDIY? Start here

Reply To: Interrupt

Home Forums Mayfly Data Logger Interrupt Reply To: Interrupt

#2270
Shannon Hicks
Keymaster

SJ-12 is for enabling the pullup resistor on D10. SJ-1 is for changing the square wave alarm signal from the RealTimeClock from A7 (default) to D10. As stated on the Jumper Settings page (https://envirodiy.org/mayfly/hardware/jumper-settings/), you should never use SJ-12 if you’ve also changed SJ-1 to D10. The two can’t be used together or it will cause problems.

So remove your solder bridge on SJ-1 and put it back to the default setting by connecting the middle pad to the one labeled “A7”. Then have your sketch look for a LOW pulse on D10 by using this line:

attachInterrupt(2, tip, LOW);

Then anytime you get a tip by the bucket (assuming you connect D10 and GND to the two NormallyOpen poles of you rain gauge switch, the Mayfly will go into the “tip” function. If you still need help, I can post an entire sketch for how to sleep the Mayfly all the time and only wake up briefly whenever there’s a tip, record the tip, then go back to sleep.