diff --git a/scripts/push.bash b/scripts/push.bash index 4fa1b2cb4e3c6992e3ab70b5da9f795ce2d71fce..678b1a00c4ad0f87eee3943baf44688dc7f28072 100755 --- a/scripts/push.bash +++ b/scripts/push.bash @@ -12,9 +12,9 @@ scripts/./write.bash sleep 10 -# python3 measure.py +python3 measure.py -# sleep 10 +sleep 10 echo -e "Starting python script:\n" loop_count=1 diff --git a/sketches/DmsMessung/DmsMessung.ino b/sketches/DmsMessung/DmsMessung.ino index 13fde2247602e01349a269fa2d4d0960e1a8922c..e8d727badc8f2651807291811e4497fc1335cd48 100644 --- a/sketches/DmsMessung/DmsMessung.ino +++ b/sketches/DmsMessung/DmsMessung.ino @@ -1,26 +1,23 @@ #include <HX711_ADC.h> - HX711_ADC LoadCell(2, 3); HX711_ADC LoadCell2(6, 7); HX711_ADC LoadCell3(8, 9); HX711_ADC LoadCell4(12, 13); - - -static float Offset = 0; +static float Offset = 0; static float Offset2 = 0; static float Offset3 = 0; static float Offset4 = 0; -int anzahl = 1000; -int caltime = 2; -float calFac = 2500; -float calFac2 = 2500; -float calFac3 = 2500; -float calFac4 = 2500; +int anzahl = 1000; +int caltime = 2; +float calFac = 2500; +float calFac2 = 2500; +float calFac3 = 2500; +float calFac4 = 2500; long stabilisation = 2000; -boolean t_are = true; +boolean t_are = true; float messwertges; float messwertges2; float messwertges3; @@ -32,108 +29,70 @@ float messwert3; float messwert4; void regelbetrieb(HX711_ADC zelle, HX711_ADC zelle2, HX711_ADC zelle3, HX711_ADC zelle4) { - float messwertAlt = messwert; + float messwertAlt = messwert; float messwertAlt2 = messwert2; float messwertAlt3 = messwert3; float messwertAlt4 = messwert4; - messwert = 0; - messwert2 = 0; - messwert3 = 0; - messwert4 = 0; + messwert = 0; + messwert2 = 0; + messwert3 = 0; + messwert4 = 0; for (int i = 1; i <= anzahl; i++) { - - zelle.update(); zelle2.update(); zelle3.update(); zelle4.update(); - - - messwert = messwert + (getDaten(Offset, zelle)); + messwert = messwert + (getDaten(Offset, zelle)); messwert2 = messwert2 + (getDaten(Offset2, zelle2)); messwert3 = messwert3 + (getDaten(Offset3, zelle3)); messwert4 = messwert4 + (getDaten(Offset4, zelle4)); - - - delay(1); } - - - - messwert = messwert / anzahl; + messwert = messwert / anzahl; messwert2 = messwert2 / anzahl; messwert3 = messwert3 / anzahl; messwert4 = messwert4 / anzahl; - messwert = messwert / calFac; + messwert = messwert / calFac; messwert2 = messwert2 / calFac2; messwert3 = messwert3 / calFac3; messwert4 = messwert4 / calFac4; - - - - - - - - - - - - } float getDaten(float offset, HX711_ADC zelle) { float Offsetnew = offset; - float data; - - - data = (float)zelle.getRareData() - Offsetnew; - - return data; } - - void writeInData() { - - if (Serial.available()) { - Serial.read(); - - + delay(10); Serial.println(1); delay(10); - - regelbetrieb(LoadCell, LoadCell2, LoadCell3, LoadCell4); - - Serial.println(messwert); delay(10); - + Serial.println(messwert2); delay(10); - + Serial.println(messwert3); delay(10); - + Serial.println(messwert4); } } @@ -145,12 +104,9 @@ float epsilonumgebung(float hierMesswert, float hierMesswertAlt) { return hierMesswert; } - void setup() { Serial.begin(9600); - - LoadCell.begin(); LoadCell2.begin(); LoadCell3.begin(); @@ -166,9 +122,7 @@ void setup() { LoadCell3.update(); LoadCell4.update(); - - - Offset = getDaten(0, LoadCell); + Offset = getDaten(0, LoadCell); Offset2 = getDaten(0, LoadCell2); Offset3 = getDaten(0, LoadCell3); Offset4 = getDaten(0, LoadCell4); @@ -176,10 +130,6 @@ void setup() { delay(500); } - void loop() { writeInData(); } - - -