Cool, thanks!
I did find a different problem - the LED adds enough current pull that the GPIO pin on the Pi can't always tell if it's been flipped. I'll have to figure out something. :/
Red, green or yellow Leds light up with a voltage between 1.4 to 1.8 Volts is applied.
When you want to use them at 12V, you need a resistor.
Assuming they have a resistor in series to be able to be used for 12V, there is something else going on.
The led consumes a certain amount of current.
The GPIO pin when set as an output is actually a current source that can only provide limited current, for example 2mA when high(sourcing) and 5mA when low(sinking). It is not uncommon that GPIO pins can sink more current then they can source.
If the led draws more current then the GPIO pin can deliver when high, the sourcing GPIO output will lower in voltage to be able to supply maximum current. This means that the voltage on the GPIO pin lowers.
When a GPIO pin is read as an input and logic voltage levels :
To a GPIO pin has to be applied a certain amount of voltage to be seen as logic high or as logic low. If this amount is not high enough, you might get into the "grey" area where the GPIO input can not determine if the pin is high or low and it randomly switches depending on temperature and power supply noise.
For non schmitt trigger inputs :
For CMOS voltage levels :
Logic low is an input voltage lower then 1/3 supply voltage.
Grey area is between 1/3 voltage and 2/3 voltage.
Logic high is an input voltage higher then 2/3 supply voltage.
TTL level :
Logic low is an input voltage lower then 0,8V.
Grey area is between 0,8V en 2V.
Logic high is an input voltage higher then 2V.
Best way is to use a transistor.
A cheap way is to let the GPIO output sink the led current.
You connect the - side of the led to the GPIO pin and the + side to the 3.3V.
But make sure you have a resistor in series.