I'm new to electronics and not sure why my setup isn't working. I've attached a schematic of what I think I have and the actual setup.
I'm confused about multiple things. First, in the picture with the original setup, I'm not sure why the LED is on without the arduino connected. I thought the transistor was supposed to act as a gate and not allow the circuit to run unless a digital signal from the arduino opens the gate.
Second, I have tried running this code:
void setup() {
pinMode(5, OUTPUT);
}
void loop() {
digitalWrite(5, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(5, LOW); // set the LED off
delay(1000); // wait for a second
}
which I would expect to blink the LED on for 1 second and off for 1 second, but nothing happens when I run it.
I've tried using a new transistor in case I broke the one I was using, but it didn't help. I'm not sure what is going on here or what I am doing wrong.
I've tried multiple resistors between the arduino and transistor including a 100 ohm, 1k ohm, and now this 100k ohm one, but all have the same result.
Any suggestions?