> For the complete documentation index, see [llms.txt](https://marlborough-college.gitbook.io/attic-lab/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://marlborough-college.gitbook.io/attic-lab/pi-pico-circuitpython/2.-rgb.md).

# 2. RGB

{% embed url="<https://www.youtube.com/watch?v=idwKHQEw78g&ab_channel=BloombergOriginals>" %}

{% embed url="<https://www.youtube.com/watch?v=15aqFQQVBWU&ab_channel=Code.org>" %}

{% embed url="<https://clarle.github.io/yui3/yui/docs/color/rgb-slider.html>" %}

<figure><img src="https://683661518-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LoUl0bEh9qy_wuo9uJ4%2Fuploads%2FAKtJ5wCAoIfU69EE32Rz%2Fimage.png?alt=media&amp;token=1ff6f1b3-1d3b-4291-a7f3-933df71ea72f" alt=""><figcaption></figcaption></figure>

```python
import time
import board
import digitalio

import adafruit_rgbled

# Pin the Red LED is connected to
RED = board.GP2
GREEN = board.GP1
BLUE = board.GP0

# Create the RGB LED object
led = adafruit_rgbled.RGBLED(RED, GREEN, BLUE)

switch = digitalio.DigitalInOut(board.GP17)
switch.direction = digitalio.Direction.INPUT
switch.pull = digitalio.Pull.UP

while True:
  led.color = (255, 0, 0)
  if switch.value == False:
      led.color = (0, 255, 0)
      # time.sleep(0.1)

# task 1: add a 0.2 second delay after the color
# changes to green. What happens?

# task 2: Modify your code to flash between blue and
# green when the button is pressed.

# task 3: Add a second button to turn the light white when pressed
      
```
