digitalRead keeps returning HIGH

can anyone tell me what's wrong with my setup? basically, i took the concept from this post:

below is the code, attached is the physical setup.

the led keeps blinking ... it should be because the digitalRead() returns HIGH? but i don't understand how can it be? originally, i have a 3-pins IR-receiver on the board, but i took i off and also tried reset arduino and re-upload the code. but the green led still keep blinking!! it blinks even if i take out the jumper from pin 11 on UNO!!

int RECV_PIN = 11;
int LED_PIN = 5;
void setup()
  pinMode(LED_PIN, OUTPUT);
  pinMode(RECV_PIN, INPUT);

void loop() {

  digitalWrite(LED_PIN, LOW);
  int status = digitalRead(RECV_PIN);
  if ( status == HIGH )
    digitalWrite(LED_PIN, HIGH);
    digitalWrite(LED_PIN, LOW);


Without the ir sensor in place, pin 11 is floating. It could read low or high at random. In your case it is reading high. It does not mean anything.

With the ir sensor in place, it reads high when no ir signal is detected. It will read low for very short periods when ir pulses are detected. Because your sketch only checks the pin once every 500ms, it will probably miss these pulses. Try changing your sketch to look for LOW.


ok, i changed the sketch to completely matching what's on the article now, and it works! i verified by pointing real remotes to it.

to your point about the floating and random read on pin 11, i tried all 1-13, a few others behave the same. can you point me to somewhere to read more about which ones are and the purposes?

could you please also take a look at this post? and give me some comments and ideas?