# RGB.control not working

**URL:** <https://community.particle.io/t/rgb-control-not-working/28541>\
**Category:** Troubleshooting\
**Created:** [January 12, 2017, 4:34pm UTC](https://community.particle.io/t/rgb-control-not-working/28541 "2017-01-12T16:34:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sheng](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@sheng](https://community.particle.io/u/sheng)\
**Post date:** [January 12, 2017, 4:34pm UTC](https://community.particle.io/t/rgb-control-not-working/28541/1 "2017-01-12T16:34:55Z")

</div>

Hi,

I am trying to turn of the RGB led on the RedBoard as a test but I can’t get it to work.

Test code:

```auto
void setup()
{
  RGB.control(true);
}

void loop()
{
  RGB.color(0, 0, 0);
}

```

After RedBoard reboot, the RGB stay on breathing cyan. Any help will be great.

[Edit] Can you move this question into troubleshooting? Sorry about that its under tutorials.

**Mod Edit (@harrisonhjones): Done and duplicate post merged**

---

<div class="post-metadata">

**Author:** ![harrisonhjones](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/harrisonhjones/32/4132_2.png) [@harrisonhjones](https://community.particle.io/u/harrisonhjones)\
**Post date:** [January 12, 2017, 5:07pm UTC](https://community.particle.io/t/rgb-control-not-working/28541/3 "2017-01-12T17:07:39Z")

</div>

What version of system firmware are you compiling again? I have a RedBoard @ Home so I can test when I get home

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [January 12, 2017, 5:09pm UTC](https://community.particle.io/t/rgb-control-not-working/28541/4 "2017-01-12T17:09:56Z")

</div>

Also make sure your device actually got the new firmware 😉  
Try adding an additional foolproof feedback like different patterns of D7 blinks or `Serial.print()` statements.

---

<div class="post-metadata">

**Author:** ![sheng](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@sheng](https://community.particle.io/u/sheng)\
**Post date:** [January 12, 2017, 5:32pm UTC](https://community.particle.io/t/rgb-control-not-working/28541/5 "2017-01-12T17:32:26Z")

</div>

After flashing the new test case few times into the RedBoard, it finally work with above case. I guess the firmware did not get updated. Then I went into testing more test cases and I found the below code would not turn off the RGB:

```
void setup()
{
  Serial.begin(9600);
 while(! htu.begin()){
  	Serial.println("HTU21D not found");
  	delay(1000);
 }
RGB.control(true);
}

void loop()
{
  RGB.color(0, 0, 0);
}

```

To get it to work, I add another RGB.control as below:

```
void setup()
    {
     RGB.control(true);
      Serial.begin(9600);
     while(! htu.begin()){
      	Serial.println("HTU21D not found");
      	delay(1000);
     }
    RGB.control(true);
    }

void loop()
{
  RGB.color(0, 0, 0);
}

```

This time I make sure the firmware get updated. 😄 But I want to find out why I needed to call RGB.control twice to get the led to turn off.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [January 12, 2017, 5:37pm UTC](https://community.particle.io/t/rgb-control-not-working/28541/6 "2017-01-12T17:37:00Z")

</div>

That’s not normal nor intended.  
Although your code does not show everything, but the cause might be hidden in these parts.  
One (unlikely) reason might be that any used library also “messes” with `RGB` or just blocks and prevents your code from reaching the second `RGB.control()` command.  
Adding a blink in `loop()` might tell that.

---

<div class="post-metadata">

**Author:** ![sheng](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@sheng](https://community.particle.io/u/sheng)\
**Post date:** [January 12, 2017, 5:39pm UTC](https://community.particle.io/t/rgb-control-not-working/28541/7 "2017-01-12T17:39:51Z")

</div>

The system firmware is 0.6.1-rc.1.

---

<div class="post-metadata">

**Author:** ![sheng](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@sheng](https://community.particle.io/u/sheng)\
**Post date:** [January 12, 2017, 6:24pm UTC](https://community.particle.io/t/rgb-control-not-working/28541/8 "2017-01-12T18:24:40Z")

</div>

@harrisonhjones, @ScruffR , I found the problem after loading into my full testing board instead of the Redboard. Its the missing parts in the redboard that cause an infinite loop in the while loop. I just need one RGB.control in the setup, it could be place either top or bottom of the setup (tested), but I think it could be anywhere in the setup. Thanks for the help. 😄 ps. @ScruffR, the blink suggestion really help for debugging.
