IR sensor program

Does anyone know where I made a mistake?

Not using an existing IR library.