colorLeds

Category:Circuit Playground

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.

Properties and Methods

Examples

Example: On and Off Button

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