Skip to content

Set speed, cycles, and width as variables #3

Description

@genregasm

Forgive me, I am new to github, I don't know how to propose a change. However, this is from the top part of the code, I modified it for the speed, cycles, and width to be easily modified.

// SETUP YOUR OUTPUT PIN AND NUMBER OF PIXELS
#define PIN        6
#define NUM_PIXELS 105
#define SPEED      0   //lower speed = faster
#define CYCLES     2
#define WIDTH      6   //trail width

Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_PIXELS, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  strip.begin();
  clearStrip(); // Initialize all pixels to 'off'
  delay(100);
}

void loop() {
  knightRider(CYCLES, SPEED, WIDTH, 0xFF1000); // Cycles, Speed, Width, RGB Color (original orange-red)
  knightRider(CYCLES, SPEED, WIDTH, 0xFF00FF); // Cycles, Speed, Width, RGB Color (purple)
  knightRider(CYCLES, SPEED, WIDTH, 0x0000FF); // Cycles, Speed, Width, RGB Color (blue)
  knightRider(CYCLES, SPEED, WIDTH, 0xFF0000); // Cycles, Speed, Width, RGB Color (red)
  knightRider(CYCLES, SPEED, WIDTH, 0x00FF00); // Cycles, Speed, Width, RGB Color (green)
  knightRider(CYCLES, SPEED, WIDTH, 0xFFFF00); // Cycles, Speed, Width, RGB Color (yellow)
  knightRider(CYCLES, SPEED, WIDTH, 0x00FFFF); // Cycles, Speed, Width, RGB Color (cyan)
  knightRider(CYCLES, SPEED, WIDTH, 0xFFFFFF); // Cycles, Speed, Width, RGB Color (white)
  clearStrip();
  delay(2000);

  // Iterate through a whole rainbow of colors
  for(byte j=0; j<252; j+=7) {
    knightRider(CYCLES, SPEED, WIDTH, colorWheel(j)); // Cycles, Speed, Width, RGB Color
  }
  clearStrip();
  delay(2000);
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions