Skip to content
Snippets Groups Projects
Commit 79b039f0 authored by Lennard's avatar Lennard
Browse files

New data

parent 034ce455
No related branches found
No related tags found
No related merge requests found
2022-06-08 12:13:57
2022-06-08 12:49:44
fatal: unable to access 'https://github.com/SirWalross/MessdatenSilo.git/': Could not resolve host: github.com
......@@ -15,5 +15,5 @@ InfoLogger:
Data:
factors: [9.6474, 0, 10.9132, -11.6764] # factors for the 4 dms
delta_time: 60 # time between logging data
delta_time: 30 # time between logging data
smoothing: false # whether to smoothe the logged data
......@@ -150,25 +150,31 @@ def main(config: Any) -> None:
recv1, recv2 = None, None
off1, off2 = None, None
while datetime.datetime.now() - datetime.timedelta(seconds=delta_time) < end_time:
con1.write(1)
con2.write(2)
try:
new_data = data.copy()
# offsets for writing data of each arduino in correct column
con1.write(1)
off1 = 0 if int(convert(con1.readline())) == 1.0 else 4
off2 = 4 if int(convert(con2.readline())) == 2.0 else 0
# read data
for i in range(4):
recv1 = con1.readline()
recv2 = con2.readline()
new_data[i + off1] += float(convert(recv1))
recv1 = None
con2.write(2)
off2 = 4 if int(convert(con2.readline())) == 2.0 else 0
for i in range(4):
recv2 = con2.readline()
new_data[i + off2] += float(convert(recv2))
recv1, recv2 = None, None
recv2 = None
n += 1
off1, off2 = None, None
data = new_data
except (TypeError, ValueError):
# may occur if no data was read over serial
......@@ -176,7 +182,7 @@ def main(config: Any) -> None:
if time.time() - last_write > delta_time:
# write data
data_logger.info(",".join([f"{value/n * factors[i] + offsets[i]:.5f}" for i, value in enumerate(data)]) + f",{n}")
data_logger.info(",".join([f"{value/n * factors[i]:.5f}" for i, value in enumerate(data)]) + f",{n}")
logger.debug("Wrote data")
n = 0
data = np.zeros((8,))
......
......@@ -13,7 +13,7 @@ static float Offset2 = 0;
static float Offset3 = 0;
static float Offset4 = 0;
int anzahl = 100;
int anzahl = 1000;
int caltime = 2;
float calFac = 2429;
float calFac2 = 2406;
......@@ -135,7 +135,6 @@ void writeInData() {
delay(10);
// Serial.print("Zelle 4 ");
Serial.println(messwert4);
delay(10);
}
}
......
......@@ -28,8 +28,8 @@ void loop() {
for (int i = 0; i < sizeof(dhts) / sizeof(*dhts); i++) {
float temp = dhts[i].readTemperature();
Serial.println(temp);
delay(10);
Serial.println(temp);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment