One backer asked the following question:
"I noticed there’s an RGB LED that’s an optional indicator for the HC-SR04 board. I like the physical design of the addition but I’m curious about the single resistor approach. Are you intentionally relying on the different forward voltages and choosing specific colours for each pin? The general solution involves 3 resistors, sometimes with a value per diode.
It's a very good question. The 3 LEDs work best at different voltages. In a regular circuit, if they share the same resistor on the common cathode, the voltage over the LEDs will be the same. The lowest one will steal current from the others. It will result in a too bright color shadowing the other two colors.
When designing the decorative LED, my major concern was to fit the circuit into a limited space and make it easy to solder. The trick was, I picked a 1000 Ohm resistor (rather than 220 Ohm) to limit the overall brightness. What's more, the (R, G, B) values can be set between 0~255 by 3 independent PWM signals. So They are not sharing the same anode! The brighter color can be dimmed by setting a smaller PWM duty. Now every color has a chance to show up and mix.
Check the following rainbow spectrum generated by the LED test code.
@Rongzhong Li Yes, I know you can use other pins. I was reacting on testled.ino in moduletests.
Testled uses pins 8,9,10 for B,G,R, so the blue on pin 8 does not follow the sine curve. Did you use other pins in your rainbow video?
Noted that the blue led is on pin 8. pin 8 is digital only and has no pwm.
0-127 is off, 128-255 is on. Pins 9 and 10 have pwm.