Need help with using Arduino act as a switch to power LED(s) using Transistor

I am using a BC547B NPN Transistor coupled with an Arduino UNO to act as a switch for an LED strip(consists of four small LEDs is series) powered through an external DC Battery.

I am a complete beginner to electronics,so i tried to implement the circuit at
Transistors - .I connected pin 8 of Arduino UNO to the base of transistor.

The problem I am facing is that the LED(s) light very dimly when pin8 is set to high.When the LED(s) are connected directly to the battery,they light properly,so the battery being discharged is not an issue.There are a couple to things I noted however:
1)If I connect the base of transistor to 5V of Arduino, LED lights properly.
2)Using any other pin of arduino still results in the same problem.
3)Mysteriously, If I touch the base resistance(10k ohm) with bare hands,the LED(s) light up perfectly.This behaviour does not depend on the state of pin8.

What could be the issue ? Please see attached circuit diagram(sorry for poor quality), I have also attached datasheet of transistor if it helps.

410427.pdf (181 KB)

Post the code. Sounds like you may have forgotten a pinMode.

EDIT, just looked at your circuit. You need a resistor to limit the current through the leds or you'll damage them.

The 10K may be a bit large for the base resistor. You'll have to look at the Q for your transistor and the current you need and do the math.

Thank You for the reply.You were right, I omitted the pinMode statement in setup loop.The LED are lighting perfectly now, and I will add a resistor as you suggested

Setup function. It isn't a loop.