Created
October 18, 2022 22:03
Revisions
-
dglaude created this gist
Oct 18, 2022 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,57 @@ """Seeeduino XIAO RP2040: Build in RGB LED simultaniously as NeoPixel.""" import time import board import neopixel import digitalio BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) WHITE = (255, 255, 255) pixel = neopixel.NeoPixel(board.NEOPIXEL, 1) pixel.brightness = 0.3 led_blue = digitalio.DigitalInOut(board.LED_BLUE) led_blue.direction = digitalio.Direction.OUTPUT led_green = digitalio.DigitalInOut(board.LED_GREEN) led_green.direction = digitalio.Direction.OUTPUT led_red = digitalio.DigitalInOut(board.LED_RED) led_red.direction = digitalio.Direction.OUTPUT led_red.value = False led_blue.value = False led_green.value = False pixel.fill(WHITE) time.sleep(1) led_red.value = True led_blue.value = True led_green.value = True pixel.fill(BLACK) time.sleep(4) while True: led_red.value = True led_blue.value = True led_green.value = True led_red.value = False pixel.fill(RED) time.sleep(0.5) led_red.value = True led_blue.value = True led_green.value = True led_green.value = False pixel.fill(GREEN) time.sleep(0.5) led_red.value = True led_blue.value = True led_green.value = True led_blue.value = False pixel.fill(BLUE) time.sleep(0.5)