Let's Make Robots!

IR Receiver


is an ir reciever digital or analog?

Also if i were to make a simpile sketch to read it would it go like this

int senspin=3;
void setup {
 pinMode( senspin, INPUT);
void loop {
  int val= analogread /** or digital read **/ (sensorpin);


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

i will look that not to copy paste any one's content.

Copy&Paste whatever you want. Make shure you give the creators a credit. All fine then.

Ok, so I took the liberty of going to the googles for you. I googled "arduino IR..." at which time the autofill gave me an option called "Arduino IR Tutorial". I clicked it.

I ended up here:


How it works, how to test, how to connect to arduino, example code.

I was spent a half an hour before looking for something like this. but didnt get this ... thanks

I have the 38khz sensor that is used in remotes... i have the remote too. What do you mean by decoding?

if you want to use the 38khz receivers. The best explanation by Robotx is here.

if you just want to read the sensor val i got the code

int sensorpin = 0;                 // analog pin used to connect the sharp sensor pin 0 analog
int val = 0;
// variable to store the values from sensor(initially zero)

  Serial.begin(9600); // starts the serial monitor
void loop()
  val = analogRead(sensorpin); // reads the value of the sharp sensor
  Serial.println(val); // prints the value of the sensor to the serial monitor

Mukund22kar. As once Geir Anderson told you to not copy&paste code or content from other websites to LMR without adding a reference to the creators. Always make a distinction between content from you and content from other people. You should not make copyright infringements.

The code-snippet you present here may come from there.

Keep in mind that you are a very talented person. No need to adorn yourself with borrowed plumes.

There are different IR receivers/sensors. 

This is an analog one, most common called Sharp and should work with your code:

Another kind are the digital receivers/transceivers:


its sending a signal and gives you a HIGH when it gets the signal back to the receiver. Normally you can adjust the range with a small screw...lets say 50cm. If in 50cm something blocks the beam it will get refelected back to the transceiver and trigger the HIGH signal.


Those are codes to a certain frequency. Most of the time 38 or 56kHz and just looking for a IR signal which is modulated in these frequency. If it sees the IR signal it will give you a HIGH on the output.


I have the reciever. But does it really only out put high or low? I thought it out puts numbers

Thank You