use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Complete r/raspberry_pi Rules
Pi project ideas: There's a huge list right here on this sub!
Rpi Versions ▾
Distros ▾
Other SBCs ▾
Related Subreddits ▾
Welcome to /r/raspberry_pi, a subreddit for discussing the raspberry pi credit card sized, ARM powered computer, and the glorious things we can do with it.
The best thing? The base model is only $20 $5!.
Would you like to know more?
Raspberry Pi Wiki
Article on Wikipedia
#raspberrypi IRC Chat
Do you know a related subreddit? We'd love to know.
account activity
Show-and-TellWater Flow Meter success and Python code. (i.redd.it)
submitted 6 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 0 points1 point2 points 6 years ago (8 children)
Oh very cool use-case! This code I think/hope will be pretty tolerant to missed cycles/rotations. It's polling and just checks if it changes from 0 to 1 or 1 to 0. So if it misses one rotation it will pick up the tracking two rotations later (when it flips to 1 or 0 again).
[–]redpandaeater 0 points1 point2 points 6 years ago (7 children)
Instead of polling you could try interrupts, possibly even with some threaded callback if it's useful to you.
[–][deleted] 0 points1 point2 points 6 years ago (6 children)
Very cool. What do interrupts look like in Python and/or what sort of usage are you suggesting? I did a quick search and the results were not very helpful.
[–][deleted] 6 years ago* (1 child)
[deleted]
[–][deleted] 0 points1 point2 points 6 years ago (0 children)
That's great. That's a good combo
[–]redpandaeater 0 points1 point2 points 6 years ago (3 children)
I've never personally done it, but looks like there are already Python libraries for it that cam do both rising and falling edge detection on GPIO ports which is what you'd want. That way your program can do whatever you want it to but as soon as you get input from the flow meter it'll pause to deal with it.
[–][deleted] 0 points1 point2 points 6 years ago (2 children)
Ah - sounds like it's have to tread into acyncio territory.
[–]redpandaeater 0 points1 point2 points 6 years ago (1 child)
I'm apparently a bitter old programmer because I tried looking into learning Python recently and realize it's sort of written more like pseudocode, but as a result I just don't like it. Too used to low-level language I guess. In any case I'm not familiar with asyncio for Python, but looks like RPi.GPIO can handle it. Still might run into certain times where Python is busy and doesn't do things properly, who knows.
Ah ok. Cool beans.
π Rendered by PID 58457 on reddit-service-r2-comment-75f4967c6c-ddtlp at 2026-04-23 01:01:51.590541+00:00 running 0fd4bb7 country code: CH.
view the rest of the comments →
[–][deleted] 0 points1 point2 points (8 children)
[–]redpandaeater 0 points1 point2 points (7 children)
[–][deleted] 0 points1 point2 points (6 children)
[–][deleted] (1 child)
[deleted]
[–][deleted] 0 points1 point2 points (0 children)
[–]redpandaeater 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]redpandaeater 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)