Sorry if this is a really basic question - software engineer here, so I'm a little out of my element.
I'm working on an IoT project, and I'm planning on using this button with a red LED inside of it.
For most of their products, this manufacturer lists how much current their stuff draws. However, in this case, they don't. The information they give is:
The forward voltage of the LED is about 2.2V so connect a 220 to 1000 ohm
resistor in series just as you would with any other LED to your 3V or higher
power supply.
I'm planning on powering it using a 2N2222 transistor connected to the 5V rail on a Raspberry Pi.
I would have naively tried simple Ohm's law, but I know that can't be correct here.
EDIT: I did a little digging through some old textbooks.
Since I'm powering it from the 5V rail, $$V = 5V = 2.2V_{LED} + V_{RESISTOR}$$
So,
$$V_{Resistor} = 2.8 V$$
Which, from Ohm's law, then gives:
$$ I_{Resistor}=I_{LED}={2.8V\over1000\Omega}=2.8mA$$
Are my calculations/reasoning correct?