Saskia wrote:And how much ampere goes threw a gpio when i put it high? So i can calculate what resistors i need.
We have 3.3 V as U
We have 12 mA for I
you need R
R = 3.3V / 0.012 A
R = 275 Ohm
so if you use 275 Ohm as R and we calculate 3.3V
you are on secure side, that you not consum more as 12mA
--------------------------------------------------------------------------
if there is 40mA
R = 3.3V / 0.04 A
R = 82.5 Ohm
--------------------------------------------------------------------------
hope this helps
this is only for "Unbranched circuit"
if you want connect a LED to GPIO
the LED has 2.2V and need 20 mA and you use 275 Ohm as Resistor
the Led power is driven by 0.6 faktor ( 12 : 20 )
hope this helps
best wishes
rudi
edit: what you search for is "ohmic law"
edit: if you want drive the led 100 procent
( you need more as 12 mA on Pin )
you have
U = 3.3V
U led = 2.2V
I led = 20mA
then you must calculate U resistor, then you can calculate R led
U = U led + U resistor
U resistor = U - U led
U resistor = 3.3V - 2.2V
U resistor = 1.1V
Resistor = U resistor / I
Resistor = 1.1V / 0.02 A ( I led )
Resistor = 55 Ohm
what you search for is "Resistance , Current limiting resistor"
Led Power on 12 mA / 20 mA
P = U * I
so
12mA
P = U led * I led
P = 2.2 * 0.012
P = 0,0264 Watt
20mA
P = U led * I led
P = 2.2 * 0.02
P = 0,044
with 12 mA you drive your LED on factor ( procent ) :
P 12mA = 0.0264 W
P 20mA = 0.044 W
P procent = ( P 12mA : P 20mA ) * 100
P procent = 0,6 * 100
P procent = 60 %
edit: and last but not least
if you have 40 mA on Pin
you must use a Resistor for limiting current
so use then the 55 Ohm resistor in the line and you will drive the LED on 2.2V and a max current of 20mA.
if there is a limit from GPIO on current example 12mA you will drive the Led with a maximum of 60 procent power.