I'm building a Raspberry Pi soil moisture monitor and I've gotten to a point where I know what I want it to do, but I don't know where to go from where I am. I've built the hardware, and have simple code to poll the sensor at whatever interval I desire, and it prints a value. What I would like is to be able to poll the sensor every hour, average those values, and tweet or email that daily average at a specified time, but I don't know how to do this. Here's what I have so far.
- import time
-
-
from board import SCL, SDA
-
import busio
-
-
from adafruit_seesaw.seesaw import Seesaw
-
-
i2c_bus = busio.I2C(SCL, SDA)
-
-
ss = Seesaw(i2c_bus, addr=0x36)
-
-
while True:
-
# read moisture level through capacitive touch pad
-
touch = ss.moisture_read()
-
-
# read temperature from the temperature sensor
-
temp = ss.get_temp()
-
-
print(" moisture: " + str(touch))
-
time.sleep(3600)
-
Any help would be greatly appreciated. Like I said, I'm brand new to coding in general, and I know I have a lot to learn, but I don't know where to go to learn it so I thought I'd start here. Sorry if this is the wrong place or something.