 
 
 }
+
+
+



int flowPin = 4;

unsigned long flowcount = 0;



void flow()
{
  flowcount += 1;
}

void calc_flow() {
  int flow_l_s, flow_l = 0;
  flow_interval = micros() - t1;
  t1 = micros();

  flow_l_s = flowcount * 100 / 450; // resulta em 100*m/2;
             flow_l = flow_l_s * 1000000 / flow_interval;

  Serial.println("litros:" + String(flow_l) + "vel:" + String(flow_l_s) + "\tInterval:" + String(flow_interval) + "\tCounter:" + String(flowcount));


}



void setup(void) {
  // put your setup code here, to run once:
  pinMode(flowPin, INPUT_PULLUP);
  attachInterrupt(flowPin, flow, CHANGE);

  Serial.begin(115200);

  WiFiManager wifiManager;

  //sets timeout until configuration portal gets turned off
  //useful to make it all retry or go to sleep
  //in seconds
  wifiManager.setTimeout(180);

  //reset saved settings
  //wifiManager.resetSettings();

  //fetches ssid and pass from eeprom and tries to connect
  //if it does not connect it starts an access point with the specified name
  //here  "AutoConnectAP"
  //and goes into a blocking loop awaiting configuration


  //and goes into a blocking loop awaiting configuration
  if (!wifiManager.autoConnect("NoFlow", "87654321")) {
    Serial.println("failed to connect and hit timeout");
    delay(3000);
    //reset and try again, or maybe put it to deep sleep
    ESP.reset();
    delay(5000);
  }

  //if you get here you have connected to the WiFi
  Serial.println("connected...yeey :)");


  Serial.print("IP address: ");
