How to log the data that comes from an IR receiver on an arduino?

Write me some code so that I can see what an IR receiver i pulled out of a toy says to my arduino, so I can tell what my TV remote is saying. I am then gonna connect a light switch to it, so when i press an unused button on my remote, lights go off. Also, Im not sure if where to plug the data pin into. Honestly, im not sure which one it even is. i jst am gona gues which until it works. Any help there would be apppreciated. A pic of the IR receiver is attached.

Schmidtn7 years ago
Try this Infrared Remote Library for Arduino. As long as your IR receiver's carrier wave is on 38Khz (which is what you'll need to work with your TV remote anyway) this library will give you pulse code in Hex. A note on IR receivers though... the three pins are source, VCC and ground. If you switch VCC and ground then you'll fry your IR receiver and be up poop creek, so be careful and spend a minute or two looking for the datasheet on your part.
frollard8 years ago
No pic attached. The arduino tutorials have TONNES of example sketches for using and dealing with IR receivers. check the arduino forums.