Ok, here is the problem.

Hi,

I am unable to address ping sensor using "duration". I guess something is incorrect. I'm not going to give up. Thank you all for the help. I will check out my "if statement" to verify if the conditions are written correctly.