I followed this instruction, but I found that it doesnot work (the RGB LED is off).
So, instead of connecting the long leg of RGB LED to ground (-), I connect it to the 5V source (+). And, it works.
But, it does not work as expected. Then, I figure out that the Logic (HIGH/LOW) is somehow inverted, so I invert the logic in my program and it works as expected.
My question is why does that happen?
\$\begingroup\$
\$\endgroup\$
3
-
\$\begingroup\$ Probably the instruction used a common cathode LED, and you used a common anode LED. \$\endgroup\$– Peter BennettCommented Jun 4, 2017 at 6:18
-
\$\begingroup\$ @PeterBennett So, Arduino logic is only designed for common cathode? \$\endgroup\$– Terry SmithCommented Jun 4, 2017 at 6:25
-
1\$\begingroup\$ No. The particular example program you used was designed for common cathode. As you found out, the program can be easily changed to deal with common anode. \$\endgroup\$– Peter BennettCommented Jun 4, 2017 at 15:04
Add a comment
|
1 Answer
\$\begingroup\$
\$\endgroup\$
0
In a common cathode LED, the common lead goes to the ground. The three individual colours are taken high to turn them on. That's positive logic.
In a common anode LED, the common lead is the positive, so is taken to +5V. The individual colours must now be taken low to turn them on. That's negative logic. It's not a function of the Arduino, it's a function of the LED and its connection.