diff options
Diffstat (limited to 'dev_scripts/sen15901rain.py')
-rw-r--r-- | dev_scripts/sen15901rain.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/dev_scripts/sen15901rain.py b/dev_scripts/sen15901rain.py new file mode 100644 index 0000000..ed54189 --- /dev/null +++ b/dev_scripts/sen15901rain.py @@ -0,0 +1,26 @@ +from gpiozero import Button +import time + +rainCount = 0 +bucketSize = 0.2794 # size of bucket in ml +rain = Button(6) # setup GPIO 6 as a button + +# every tip add 1 to count +def tipped(): + global rainCount + rainCount +=1 + print (rainCount * bucketSize) + +def resetRainfall(): + global rainCount + rainCount = 0 + +rain.when_pressed = tipped + +""" +# test loop + +while True: + rain.when_pressed = tipped + time.sleep(1) +""" |