 
 void pinValT2()
 {
+  T2.previousFlowing = T2.flowing;
   if(digitalRead(T2.flowPin) == HIGH)
   {
     if(flowTapPin2Value == 0)

      if(T0.previousPulseCount != T0.pulseCount)
      {
        T0.flowing = 1;
        Particle.publish("start-flow-T0", String(T0.maxPulseCount) + "," + String(T0.pulseCount) + "," + String(T0.percentFull));
      }
      else
      {
        T0.flowing = 0;
        // Particle.publish("stop-flow-T0", String(T0.maxPulseCount) + "," + String(T0.pulseCount) + "," + String(T0.percentFull));
      }
      T0.previousPulseCount = T0.pulseCount;
      T0.previousSecond = T0.currentSecond;

  pinValT0();
  pinValT1();
  pinValT2();
  calculatePercentFull();
  publishFlowingEvents();
  handleAnimation();
  writeToEEPROM();
}

void writeToEEPROM()
{
  EEPROM.put(EEPROM_ADDR_T0, T0);
  EEPROM.put(EEPROM_ADDR_T1, T1);
  EEPROM.put(EEPROM_ADDR_T2, T2);
}

void calculatePercentFull()
{
  float percentT0 = (float)T0.pulseCount / (float)T0.maxPulseCount;
  T0.percentFull = (int)(percentT0 * 100.0f);
  if(T0.percentFull > 100)
    T0.percentFull = 100;

  float percentT1 = (float)T1.pulseCount / (float)T1.maxPulseCount;
  T1.percentFull = (int)(percentT1 * 100.0f);
  if(T1.percentFull > 100)
    T1.percentFull = 100;
  
  float percentT2 = (float)T2.pulseCount / (float)T2.maxPulseCount;
  T2.percentFull = (int)(percentT2 * 100.0f);
  if(T2.percentFull > 100)
    T2.percentFull = 100;
}

void handleAnimation()
{
  if(T0.flowing)
  {
    Serial.println("flowingT0: " + String(T0.flowing));
