colorLeds[i].stop()

Category:Circuit Playground

Stops the colorLEDS from blinking.

While colorLeds[i].stop() will stop the color LEDs from blinking, it won't necessarily turn the color LED(s) off. A color LED can be left on or off depending on where .stop() catches the LED when it's blinking, so it's just stopping the color LED from blinking, not turning it off completely.

For example, using .stop() on a color LED that's blinking will make the blinking the stop. But if you use .stop() on a color LED that's been turned .on(), it will stay on.

Examples

//Try turning the colorLED on, and then see what happens when you click the stop button.

onEvent("off", "click", function(event) {
  colorLeds[5].off();
});

onEvent("on", "click", function(event) {
  colorLeds[5].on();
});

onEvent("blink", "click", function(event) {
  colorLeds[5].blink(100);
});

onEvent("stop", "click", function(event) {
  colorLeds[5].stop();
});

Syntax

colorLeds[index].stop()

Found a bug in the documentation? Let us know at documentation@code.org