Post your code, please.
Perhaps if you understand that it's an ultrasound ranger, not IR, things might be a little clearer.