I am not new to Arduino but I do about one project a year and always seem to forget certain basic things. I am starting out on a simple project and need to check that I have thought it through correctly.
I want to do something really simple - to have 8 SMD LEDs (with a forward current of 20mA and a voltage of 3.6V) all flashing on and off together, controlled by an Arduino Uno,
i.e. pins 3-12 HIGH delay(800), pins 3-12 LOW delay(800) repeat.
Ideally the project would work either powered by a lithium battery or by the standard 9V power supply.
The battery version is intended only to work for a couple of hours - until the battery runs out. In the long term, the project would be powered by the standard 9V power and would be able to run 8 hours a day for three months without the LEDs dying.
To my simple brain it seems like I can do this by simply connecting each of pin 3 - 12 to a resistor, then to the positive pin of the LED, then from the negative pin of the LED to the GND and control the ON/OFF state by coding the pins to be HIGH or LOW.
But this seems too simple... Am I on the right lines? Or should I rethink this?
If I am on the right lines, as I want around 3V on the LED, I want to have 2V on the resistor. So 2/0.02 = 100, which means I want a 100ohm resistor for each LED, right?