I have RGB led and I want to hook it up to the arduino with only two pins (1-Ground pin 2-R G B pins).
There is any way to do so ?
Yes, but you will get only one colour, so why not use an ordinary led? Also the brightness will be lower.
You should use 3 series resistors with the rgb led. You can adjust these to get the colour you want, but take care not to exceed the max current for any of the r, g or b elements, or the max output current of the arduino pin.
I assume from your question this is a common cathode rgb led?
Paul
In principle you could drive an RGB LED from only 2 pins, but you will need external hardware (e.g. transistors) to do so. If you are short of pins, then it's often possible to share some pins between devices.
There are some 2 pin RGB LEDs that automatically cycle through colours when they are powered.
Grumpy_Mike:
There are some 2 pin RGB LEDs that automatically cycle through colours when they are powered.
Like these -
Slow fade
Fast blink
Or, with ground, digital pin (on Arduino), plus external power (+4-7V) you can control a whole bunch of these RGBs —