I’m trying to use the on-board LED for anything other than red. I’ve searched and can’t seem to locate how to apply an RGB code, or just use the basic 3 colors. NeoPixel does not seem compatible with the LED that is on my XIAO board. Any Circuit Python guru help is greatly appreciated.
Hi there ,
Well far from Guru but I did read the Circuit python link about **boards and LED’s**It sends you to Adafruti.
“To see all the available board-specific objects and pins for your board, enter the REPL (>>>
) and run the following commands:”
but just do this and see what it shows you then add that to your code.
this is for the samd21 but same thing on yours Xiao.
in arduino it’s LEDR or LED_G or BUILTIN_LED, or LED BLUE
HTH
GL PJ
Thanks PJ. I got this:
Adafruit CircuitPython 8.2.9 on 2023-12-06; Seeed XIAO nRF52840 Sense with nRF52840
import board
dir(board)
[‘class’, ‘name’, ‘A0’, ‘A1’, ‘A2’, ‘A3’, ‘A4’, ‘A5’, ‘CHARGE_RATE’, ‘CHARGE_STATUS’, ‘D0’, ‘D1’, ‘D10’, ‘D2’, ‘D3’, ‘D4’, ‘D5’, ‘D6’, ‘D7’, ‘D8’, ‘D9’, ‘I2C’, ‘IMU_INT1’, ‘IMU_PWR’, ‘IMU_SCL’, ‘IMU_SDA’, ‘LED’, ‘LED_BLUE’, ‘LED_GREEN’, ‘LED_RED’, ‘MIC_PWR’, ‘MISO’, ‘MOSI’, ‘NFC1’, ‘NFC2’, ‘PDM_CLK’, ‘PDM_DATA’, ‘READ_BATT_ENABLE’, ‘RX’, ‘SCK’, ‘SCL’, ‘SDA’, ‘SPI’, ‘TX’, ‘UART’, ‘VBATT’, ‘board_id’]
Then created this code to flash Red, Blue, Green and it works great!!!
import time
import board
import digitalio
ledred = digitalio.DigitalInOut(board.LED_RED)
ledred.direction = digitalio.Direction.OUTPUT
ledblue = digitalio.DigitalInOut(board.LED_BLUE)
ledblue.direction = digitalio.Direction.OUTPUT
ledgreen = digitalio.DigitalInOut(board.LED_GREEN)
ledgreen.direction = digitalio.Direction.OUTPUT
while True:
ledred.value = False # Red LED is on.
time.sleep(0.5)
ledred.value = True # Red LED is off.
time.sleep(0.5)
ledblue.value = False # Blue LED is on.
time.sleep(0.5)
ledblue.value = True # Blue LED is off.
time.sleep(0.5)
ledgreen.value = False # Green LED is on.
time.sleep(0.5)
ledgreen.value = True # Green LED is off.
time.sleep(0.5)
Outstanding!
Well Done… I like it! ROCK!