IRremote Problem

Hello everyone.
Im having trouble programming an infrared sensor. I have the emitter and the reciever and with this i want it to stop a Servo Motor SG90 of moving. What I want it to do is, when I press a button if nothing is in the line of the infrared sensor the servo moves 90 degrees, if there is somethink in the line of the sensor the servo wont move. Its basically to simulate a automatic gate with a button for a model house.
Can someone help me? I alredy have the library installed but i dont hunderstand how it works.
Sincerely,
João Palácio

Which library? IRremote as in the title? That is for infrared remote controls and from your description that is not what you're using.

No experience with ir transmitters and receivers but to my knowledge the receiver works, in simple terms, like a switch / push button.

The library im using is IRremote. I have a friend that used the same sensor and he used that library, he cant help me now because he is out of the country and I need it this week

Now you're only talking about a receiver. What happened to the emitter from the first post.

If that emitter is e.g. a remote control for a TV, you can start with the IRrecvDemo that comes with the library.
If that emitter is something else, please post links for both emitter and receiver.

This is the DataSheet of the emitter and the reciever

TSOP58338-Vishay.pdf (151 KB)

Perhaps you forgot to include the data sheets for the Transmitter (emitter)?

Most IR emitters are designed for a duty cycle of a MAX of 50%. Connecting one to power and ground without a proper current limiting resistor or driving it with a timer of some sort will fry it in a hurry.

Please post the data sheets for the emitter you are using and a diagram of how you are connecting it to power.

30 years of IR remote design....