473,326 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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.

Expand|Select|Wrap|Line Numbers
  1. import time
  2.  
  3.     from board import SCL, SDA
  4.     import busio
  5.  
  6.     from adafruit_seesaw.seesaw import Seesaw
  7.  
  8.     i2c_bus = busio.I2C(SCL, SDA)
  9.  
  10.     ss = Seesaw(i2c_bus, addr=0x36)
  11.  
  12.     while True:
  13.         # read moisture level through capacitive touch pad
  14.         touch = ss.moisture_read()
  15.  
  16.         # read temperature from the temperature sensor
  17.         temp = ss.get_temp()
  18.  
  19.         print("  moisture: " + str(touch))
  20.         time.sleep(3600)
  21.  
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.
Jan 19 '20 #1

✓ answered by dwblas

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.

2 1331
dwblas
626 Expert 512MB
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.
Jan 20 '20 #2
@dwblas
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!
Jan 21 '20 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Camiel | last post by:
Hi, I'm trying to do the following: create a form, with at the top a list of values drop-down box, filled with values from table A. Also at the top, an input box to enter a year. Below...
12
by: deko | last post by:
Is there an easy way to make all negative values positive in a particular table? I've been experimenting with this: Dim rst As DAO.Recordset Set rst = db.OpenRecordset("tblNegValues") Do...
2
by: Jared | last post by:
Store List Box values I have a form that has hundreds of records in it. The form has a list box with 10 different options in it. The user is able to select multiple options from the list box....
3
by: Manfred Braun | last post by:
Hi All, I try to list the values from an objects array member: FieldInfo fis = a.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance); for(int i = 0; i < fis.Length; i++) {
2
by: Lakshmi Prasanna | last post by:
Hi, Iam prasanna , iam not using any frame works.iam developing my project code in advance java. My problem is iam getting information from server side.Now i want to show those detaials in to a...
6
by: psbasha | last post by:
Hi, I am assigning the list/dict values to another list/dict variable as shown below. List : List1 = List2 = List1
9
by: Ajinkya | last post by:
Hello friends ! , I am very new to java script.If anyone can help me then I will be very very thankful to his/her. I am using php and mysql in my project and I have one textarea and one...
2
by: sanano3062000 | last post by:
HI i have inserted values into list box control using java script when i try to save the values in to data base values of list box control are lost.. This is called as lost of list box values on...
0
debasisdas
by: debasisdas | last post by:
The following sample code is designed to display the use of accepting a list of values in a single parameter and process the same in the where clause inside a procedure. STEP1:-First create an...
1
by: Tiger1 | last post by:
Below are my code lines for computing cosine similarity over a list of values. My goal is to compute the cosine similarity by comparing each value in the f-list( f=, , , , ]) with the rest values and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.