...Your are confusing Power
(Watts) and energy
(Watt-hours). For example, small batteries are rated in milliamp-hours (mA-hr), and from that you can calculate mW-hours. You can "pull" a lot of milliwatts (maybe a few Watts) from a battery for a short time, or the battery will run longer if you pull less power out of it.Power is calculated as Voltage X Current.
If you have 2 Volts across an LED and 20milliamps flowing through it, that's 40mW. Over 3 Hours, that's 120mW-hours.
If you don't know how much current is flowing through the LED you can calculate (or estimate) it if you know the series resistance and the applied voltage.
Let's say you have an LED rated for 2V @ 20mA. Unlike resistors, LEDs have (approximately) constant voltage drop (when they are on and operating normally). In a series circuit, the same current flows through all components, but the applied voltage is divided among the components.
(That's Kirckhoff's Laws
Let's say we have a 200 Ohm resistor. With 5V from the Arduino and 2V across the LED, that leaves 3V across the resistor. Using Ohm's Law
, we can calculate the current. 3V/200 Ohms = 0.015 Amps (15mA). The same 15mA is flowing through the LED with 2V across it, so we have 30mW of power dissipated in the LED (2V x 15mA). Plus 45mW wasted in the resistor (3V x 15mA). Or if you want the total power coming out of the Arduino, 5V x 15mW = 75mW, which is the same as 30mW + 45mW.
If you have a multimeter, you can measure the voltage across the resistor and LED to make a better calculation. (The LED voltage rating
is not always exact.) In order to measure current you have to break the connection and insert the multimeter in series. So, it's usually best to measure the voltage across the known resistance and calculate
the current through it.