Switch between red and blue lights.
Use a loop to continuously check if Button A is pressed, and then set the color of the RGB LED A to either red,when pressed, or blue,while not pressed.
basic.forever(function () {
if (input.buttonIsPressed(Button.A)) {
sb.setRgbLedColorRGB(sb.rgbLed(SBRgbLed.RgbLedA), 100, 0, 0)
} else {
sb.setRgbLedColorRGB(sb.rgbLed(SBRgbLed.RgbLedA), 0, 0, 100)
}
})If using micro:bit for the first time, follow this setup.