5MM Infared Receiver Diode


where could I find an exemple to test a IR-Diode and 5MM Infared Receiver Diode? I tried with code like bellow, but it does not seem to work.

The IR-Diode gets current from pin 3 at pin 4 there is a normal LED that should blink when 9 gets HIGH The IR-Receiver is connected to the input pin 9 and ground

Thanks for any advices or links to exemples...



int pin_9 =9;
int pin_3=3;
int pin_4=4;

void setup()
  pinMode(pin_3, OUTPUT);
  pinMode(pin_4, OUTPUT);
  pinMode(pin_9, INPUT_PULLUP);


void loop()

  digitalWrite(pin_3, LOW);

  if (digitalRead(pin_9)==LOW){
    digitalWrite(pin_4, HIGH);

    digitalWrite(pin_4, LOW);



Test the circuit with a multimeter. Use an oscilloscope to see voltages on the sensor : does it have digital levels for ‘1’ and ‘0’ ?

Show us your schematics..

It looks like you are setting pin 3 to be always LOW.

You might need to set pin 3 HIGH sometimes?

..but you will also need to turn it off as well!