# Crossfading LEDS

**URL:** <https://community.sparkfun.com/t/crossfading-leds/47388>\
**Category:** LEDs\
**Created:** [May 9, 2024, 4:06pm UTC](https://community.sparkfun.com/t/crossfading-leds/47388 "2024-05-09T16:06:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pinkunicorn](https://avatars.discourse-cdn.com/v4/letter/p/a87d85/32.png) [@pinkunicorn](https://community.sparkfun.com/u/pinkunicorn)\
**Post date:** [May 9, 2024, 4:06pm UTC](https://community.sparkfun.com/t/crossfading-leds/47388/1 "2024-05-09T16:06:50Z")

</div>

ok so how would I cross fade custom rgb colors

so like I have a green and want to cross-fade it to a pink? how would I do that?

---

<div class="post-metadata">

**Author:** ![aliarifat794](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@aliarifat794](https://community.sparkfun.com/u/aliarifat794)\
**Post date:** [May 10, 2024, 7:36am UTC](https://community.sparkfun.com/t/crossfading-leds/47388/2 "2024-05-10T07:36:58Z")

</div>

You have to use PWM and mix the 3 basic colors in different ratio. Suppose, you have a CC RGB LED. You want to make magenta color, the respective arduino code will be,

```auto
      analogWrite(redPin,100);
      analogWrite(greenPin,0);
      analogWrite(bluePin,5);

```
