Relay works only with pin 2 and 3

Hello,

I would like to ask if someone has same experience.

I used this schematic to connect relay to my Arduino:

When I connect circuit to pin number 2 or 3 with code:

digitalWrite(2, LOW);
digitalWrite(3, LOW);

everything is OK. Relay click and stay switched for whole time.

But when I try same circuit connect to another pin e.g. 8, relay starts click and it click in every loop section.
FYI: I need pins 2,3 for another purpose (Interrups)

I don’t know if there is something wrong with my Arduino or if there is some mistake in circuit.

Thanks.

If the same circuit works with pins 2 and 3, then it's probably your code.

I used same code for every pin but only pins 2,3 works as I expected.

We need to see the code that doesn't work. .

This makes clicks:
void setup() {
pinMode(8, OUTPUT);
}
void loop() {
digitalWrite(8, LOW);
}

and this not:
void setup() {
pinMode(2, OUTPUT);
}
void loop() {
digitalWrite(2, LOW);
}

How is the relay board being powered? Do you have a GND on the Arduino going to the GND of the relay board?

Relay board got its own power supply. And yes GNDs are connected.

Try using:

void setup() {
  pinMode(14, OUTPUT); // 14 is the same as A0 (analog input 0)
}
void loop() {
   digitalWrite(14, LOW);
}

Thanks to all for help, but I found out that there is something with my libraries :P

I used Eclipse for upload programs, but when I tried to use Arduino IDE it works perfectly even with pin 8.

I will try to find out what is wrong and I will post it here.