Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • main
  • latest
2 results

Target

Select target project
  • Lennard/messdatensilo
1 result
Select Git revision
  • main
  • latest
2 results
Show changes
#!/bin/bash
cd `dirname "$0"`/..
echo -e "\n\n#####################################################################"
echo $( date '+%F %H:%M:%S' ) | tee -a bash.log
echo "" | tee -a bash.log
scripts/./push.bash 2>&1 | tee -a bash.log
......
......@@ -6,34 +6,28 @@ while pidof -x "python3 main.py">/dev/null; do
echo "python3 main.py is still running, checking in 60 seconds."
sleep 60
done
sleep 10
scripts/./write.bash
sleep 10
python3 measure.py
scripts/./write.bash
sleep 10
echo -e "Starting python script:\n"
loop_count=1
while : ; do
python3 main.py
return_code=$?
if [[ "$return_code" -eq 0 ]]; then
echo -e "\nPython script ended"
break
fi
if [[ "$loop_count" -eq 10 ]]; then
echo -e "\nPython script failed too many times, trying again tomorrow"
break
if python3 main.py then
rm data/data
fi
echo -e "Ended with error, waiting and trying again"
loop_count=$((loop_count + 1))
sleep $((loop_count * 60))
done
echo -e "\nPython script ended"
git pull
last_commit_name = $(git log -1 --pretty=%B | cat)
if [[ $string == *"New data"* ]]; then
# check if the last commit was "New data"
# if yes overwrite the commit
git reset --soft HEAD~1
fi
git add .
git commit -m "New data" && git push --force
\ No newline at end of file
#!/bin/bash
# Compile and upload the DmsMessung und Temperaturmessung sketches to the
# arduinos. First getting the serial ports that each arduino is connected
# to, then checking some things and then compiling and uploading the sketches.
cd `dirname "$0"`/../sketches
fqbn=arduino:avr:uno
......
......@@ -77,21 +77,20 @@ void writeInData() {
if (Serial.available()) {
Serial.read();
delay(10);
delay(20);
Serial.println(1);
delay(10);
regelbetrieb(LoadCell, LoadCell2, LoadCell3, LoadCell4);
Serial.println(messwert);
delay(10);
delay(20);
Serial.println(messwert2);
delay(10);
delay(20);
Serial.println(messwert3);
delay(10);
delay(20);
Serial.println(messwert4);
}
......
......@@ -8,6 +8,7 @@
#define DHT_Typ DHT11
DHT dhts[] = {DHT(DHT1_Pin, DHT_Typ), DHT(DHT2_Pin, DHT_Typ), DHT(DHT3_Pin, DHT_Typ), DHT(DHT4_Pin, DHT_Typ)};
float temp[4];
void setup() {
Serial.begin(9600);
......@@ -21,16 +22,17 @@ void loop() {
if (Serial.available()) {
Serial.read();
delay(10);
delay(40);
Serial.println(2); // for identification
for (int i = 0; i < sizeof(dhts) / sizeof(*dhts); i++) {
dhts[i].readHumidity();
float temp = dhts[i].readTemperature();
temp[i] = dhts[i].readTemperature();
}
delay(10);
Serial.println(temp);
for (int i = 0; i < sizeof(dhts) / sizeof(*dhts); i++) {
delay(40);
Serial.println(temp[i]);
}
}
}