no luck. I'm sorry, i am a very slow learner. I've set prevSensorValue to read analog values which i understand in your code isn that if prevSensorValue is different from currsensorValue (both are equal to analog ping pin), and the difference is greater then 5, (> bigChange which i set to 5), then, then= millis(). and below that statement, digitalWrite(led13, HIGH); and inverse for below. nothing aside from declaring then to equal millis and send a led high signal are my understand of what goes on there. hope I'm on the right track at least. I'm not having good results.
prevSensorValue = analogRead(pingPin);
int currSensorValue = analogRead(pingPin);
if((abs(currSensorValue - prevSensorValue)) > bigChange)
{
// a change occurred
then = millis();
digitalWrite(led13, HIGH);
// Do something with the sensor data
}
now = millis();
if(now - then > longTime)
{
digitalWrite(led13, LOW); // It's been a while since a change occurred
}