Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

Version 1 Next »

Purpose

Display a sequence of colors on the NeoPixel.

When to use

When you want to start the pattern.

Where to use

Anywhere.

Calling this function again will stop a pattern that was already executing. Make sure to not call it repeatedly.

Returns

N/A

Main prototype and parameters

void CrcLib::ShowColorPattern(const ColorDuration colors[], bool repeat)

The following parameters must be passed to the function for it to work properly:

  • The sequence of colors to display

  • Whether to loop the pattern

Overloads

void CrcLib::ShowColorPattern(ColorPattern* pattern)

A more advanced version of the function you probably don’t need. If you want to use it, read CrcBuzz.h for more info.

Examples

 #1: Display a sequence of colors on the NeoPixel
#include <CrcLib.h>

// See the page about Color
// Define a pattern using { <duration in ms>, <note frequency in Hz> }
ColorDuration pattern[]
    = { { 750, Color(213, 4, 200) }, { 500, BLUE_LOW }, ColorDuration::END };

CrcLib::Timer timer;
void setup() {
    CrcLib::Initialize();
    timer.Start(2000);
}

void loop() {
    CrcLib::Update();

    if (timer.IsFinished()) { // start the tune each 2s
        timer.Next();
        CrcLib::PlayTune(notes, false);
    }
}

Content by Label

  • No labels