1
\$\begingroup\$

Arduino sketch for my program

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?

\$\endgroup\$
3
  • \$\begingroup\$ Probably the instruction used a common cathode LED, and you used a common anode LED. \$\endgroup\$ Commented Jun 4, 2017 at 6:18
  • \$\begingroup\$ @PeterBennett So, Arduino logic is only designed for common cathode? \$\endgroup\$ Commented 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\$ Commented Jun 4, 2017 at 15:04

1 Answer 1

2
\$\begingroup\$

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.

\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.