Only one LED is blinking ATTINY45

Hello!

I've made a project where two leds should blink like a police light.
I have a red and a blue led but only the red is blinking. when i pull the red led out, the blue one blinks.

Hi,
Is your tiny happy with 9V?
The 220R resistor at the 9V will not provide a regulated supply. (OhmsLaw)
As your LEDs turn on and off, the current through the 220R at the 9V will change.

Its easier to hand draw your schematic and then scan or photograph it.

Or use an easy schematic editor, its free..

What attiny is it.

Can you please post a copy of your sketch, using code tags?
They are made with the </> icon in the reply Menu.
See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

Tom.... :slight_smile:

This article?
https://jaunty-electronics.com/blog/2012/09/microcontroller-controlled-police-strobe-light/

You can't just replace a ~4.8volt battery with a 9volt battery and series resistor.
Leo..

Stop doing that before you toast your tiny!

The chip is spec'ed for operation from no more than 5.5 volts, and you are applying 9 to it.

The reason you don't get the behavior you expect, is that 220 ohm resistor to ground. As you turn on the LEDs, the voltage on the ground pin of the tiny goes up, and applied voltage on the chip goes down.

You need a 5v regulator if powering off 9v (alternately, you could just power off 3 AA batteries and not use regulator.

Do not put a resistor between the ground pin of the chip, and ground of your power source. Ever.

You need a 0.1 uf ceramic capacitor between Gnd and Vcc, as close to the chip as possible. You need this on just about any IC, not just microcontrollers.