Each element in the array is one of the 10 RGB LEDs on the board (this does not include the red LED next to the USB port). You can access an individual LED by specifying its index, or position within the colorLeds array. The first LED is to the left of the USB connect, and can be accessed at index 0 - colorLeds[0].
When using this block you're only able to access one LED at a time. To control multiple at once you'll have to use it multiple times.
colorLeds[i].on()
- Turn the LED(s) on.colorLeds[i].off()
- Turn the LED(s) off.colorLeds[i].toggle()
- Alternate between turning on and off.colorLeds[i].blink()
- Blink at a given rate.colorLeds[i].pulse()
- Pulse at a given rate.colorLeds[i].stop()
- Stop the LED(s) from blinking or pulsing. This command can only be accessed in text mode.colorLeds[i].intensity()
- Set the brightness of the LED(s).colorLeds[i].color()
- Change the color of the LED(s).onBoardEvent(buttonL, "down", function(event) { colorLeds[0].on(); colorLeds[9].on(); }); onBoardEvent(buttonR, "down", function(event) { colorLeds[0].off(); colorLeds[9].off(); });
Found a bug in the documentation? Let us know at documentation@code.org