I'm trying to set up a flow meter on my Arduino and it's currently connected to D32. This pin is unable to be used for interrupts, but every solution to my problem on the internet that I've found has involved interrupts. Does anyone have any experience with flow meters and is able to help me to set it up without using interrupts?
Yeah that's what I've been trying to do, but no success so far. I'm using the PinChangeInterrupt library and am running attachPinChangeInterrupt(flowPin, test , RISING);
, where flowPin is 32 (where the flow meter is connected) and test is a function that just prints to the serial monitor. But no success
It is unwise to try to print from an ISR as interrupts are disabled in the ISR and print needs interrupts. In the ISR increment a volatile variable and set a flag. Then in loop, check the state of the flag. If the flag is set, print the count and clear the flag.
If you want more help, post your code. Read the forum guidelines to see how to properly post code.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.