Can I make a list of printed values, average them, and tweet/email the result?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ClickOnRun
    New Member
    • Jan 2020
    • 2

    Can I make a list of printed values, average them, and tweet/email the result?

    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.

    Code:
    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.
  • dwblas
    Recognized Expert Contributor
    • May 2008
    • 626

    #2
    What I would like is to be able to poll the sensor every hour, average those values
    Store the results in a list of lists or dictionary, and average from the start and end time of your choice.

    Comment

    • ClickOnRun
      New Member
      • Jan 2020
      • 2

      #3
      Originally posted by dwblas
      Store the results in a list of lists or dictionary, and average from the start and end time of your choice.
      This is a great start, thank you very much! At least I know what to look for. I'm off to learn how to do those things now!

      Comment

      Working...