diff --git a/src/main.cpp b/src/main.cpp index 7498e4b..4136ed7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,7 +34,7 @@ unsigned long last_print=0; #define PIN_BUTTON 12 -#define PIN_LED 2 +#define PIN_LED 13 void setup() { @@ -86,16 +86,16 @@ void loop() { - //ec_loop(loopmillis); + ec_loop(loopmillis); - //temperature_loop(loopmillis); + temperature_loop(loopmillis); //waterlevel_loop(loopmillis); - flow_loop(loopmillis); + //flow_loop(loopmillis); //sm_loop(loopmillis); @@ -109,42 +109,9 @@ void loop() { digitalWrite(PIN_LED,HIGH); } - static bool started=false; - static bool ended=false; - static unsigned long started_time=0; - static unsigned long ended_time=0; - - if (flow_counter_sum>10 && !started && !ended) { //start - started=true; - started_time=millis(); - Serial.println("Started!"); - } - static uint32_t last_flow_counter_sum=0; - if (loopmillis>last_print+1000) { //test check - last_print=loopmillis; - if (started && !ended) { - Serial.println(flow_counter_sum-last_flow_counter_sum); - if (flow_counter_sum-last_flow_counter_sum<=2){ //stopped - ended=true; - ended_time=millis(); - Serial.println("Ended!"); - } - - last_flow_counter_sum=flow_counter_sum; - - } - if (ended) { - Serial.println("counts,time"); - Serial.print(flow_counter_sum); - Serial.print(","); - Serial.print((ended_time-started_time)/1000.0); - Serial.println(); - delay(10000); - } - } - if (loopmillis>last_print+2000 && 1==2) { + if (loopmillis>last_print+2000) { //if (ec_flag_measurement_available && getReading) { if (ec_flag_measurement_available) { last_print=loopmillis; @@ -154,7 +121,7 @@ void loop() { Serial.print(millis()/1000.0,2); Serial.print(","); - /* + Serial.print(getMeanf(tempCmean_reservoir,TEMPMEAN_SIZE)); Serial.print(","); //Serial.print(getMean(sm_mean,SM_SIZE)); Serial.print(","); @@ -163,7 +130,7 @@ void loop() { Serial.print(ec_adc_adjusted); //Serial.print(","); //Serial.print(ec); Serial.print(","); //Serial.print(ec25); - */ +