Alternating 3 LED project

I think this would be simplest with an Arduino. There’s a sample program called “Blink,” it’s one of the simplest possible programs, that could be modified a little to do what you want.

I’m imagining you using 3 LEDs of each color so that you can diffuse the light and have a reasonably large circle for each traffic light. Say you choose resistors to go with your LEDs to pass about 10mA through each LED. If you’ve got 3 LEDs per color, that means that the LEDs will be pulling about 30mA at any given time. The Arduino board itself draws something around 60mA for a total of 90mA - at that draw I’d expect a new 9V battery to last 3-ish hours, probably long enough for a costume, so that’s good.

Check out this page on the blink code:https://www.arduino.cc/en/tutorial/blink

You’d need to connect each LED (and its resistor) to a separate pin and in the code you’ll give these pins names by typing something like “int green1 = 2;” (you can see examples of that in the “fade” sample code https://www.arduino.cc/en/Tutorial/Fade)

Then in the “setup” part of the code, you’d set up each of the pins you’re using to be an output like they do in the blink code (substituting your names for LED_BUILTIN).

Then, in the main loop, you’d turn on all the green LEDs, delay for however long you want the light to stay on, turn off all the greens, turn on all the yellows, delay, turn on all the reds, delay. And there you go!

Be careful to put the input from the battery into the pin labeled “Vin” rather than the 5V or 3.3V pins and I’d use pins 2-10, skip 0 & 1.

Good luck!