     Particle.publish(eventPrefix + "/waterTankSensor/online", "true");
     
     // water height
-    duration = pulseIn(A0, HIGH);
-    distance = duration / uSperInch; // in inches
-    waterHeight = totalDistance - distance;
     ThingSpeak.setField(1, waterHeight);
 	
 	Particle.publish(eventPrefix + "/waterTankSensor/waterHeight", String(waterHeight));

                System.sleep(SLEEP_MODE_DEEP, wakeUpTimeoutShort);
            }
    }
}

void eventHandler(String event, String data)

float distance;
unsigned long duration;
float waterHeight;
float waterHeightSum;
//################### update these vars ###################
float totalDistance = 64; // the distance from the sensor to the bottom of the water tank
//################### update these vars ###################
unsigned long lastUS = 0;
unsigned long USmeasureTime = 1000; // measure every second

// photocell
float lightIntensity;
