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.

Which one do you have? The Sharp spits out a lot of numbers for the analog readings. The others should only give you a HIGH (1) or LOW (0). Make sure your DIGITAL sensor is connected to a DIGITAL input...or analog to analog...

From my recent experience with analog pins on the Arduino UNO; you won't need the pinMode() function which is used with digital pins if you are reading an analog ir photocell. If it is digital then you'd keep the pinMode(); and use digital read. There are also some libraries/code available eg: http://arduino.cc/playground/Code/InfraredReceivers It would be helpful if you/we knew exactly what part you were using and how you planned to wire it. Or if you are looking for one you could check the data sheet. Most suppliers have data sheets posted With more detailed information; sometimes even example wiring (though probably not for an Arduino). Just my $0.02, hope that helps.

A IR phototransistor (the one that looks like a led) could be read as either a digital or analog signal --and would of course, need a pullup resistor etc.

A 38khz sensor (3-pin, used with remote controls) is read as a digital input and requires some "decoding" when/as the signal is received.

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