added threshold to IR sensor