The idea with this one is to just randomly flash random colors on random pixels. This is a good example of where using the (r,g,b) version of setPixelColor() is useful. We'll generate a random red value, a random green value, and a random blue value. Then we just call setPixelColor(pixel, r, g, b) for a random pixel.

This could have been done using the hex value, but coding this way is more readable and intuitive.

// Circuit Playground Bike Light - Bedazzler
// Author: Carter Nelson
// MIT License (

#include <Adafruit_CircuitPlayground.h>

#define BEDAZZLE_RATE   100     // lower is faster

void setup() {
  // Make it bright!

void loop() {
  // Turn off all the NeoPixels

  // Turn on a random pixel to a random color
    random(10),     // the pixel
    random(256),    // red  
    random(256),    // green
    random(256) );  // blue  

  // Leave it on for a little bit

This guide was first published on Apr 24, 2017. It was last updated on Apr 24, 2017.

This page (The Bedazzler) was last updated on Mar 05, 2021.

Text editor powered by tinymce.