From ec51b6b30cdbd578f04827216bd9bfbfc1ba0c4a Mon Sep 17 00:00:00 2001 From: KurtMF Date: Mon, 25 Nov 2024 16:10:31 -0500 Subject: [PATCH] Changed Cylon to run w/o FastLED --- examples/Cylon/Cylon.ino | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/examples/Cylon/Cylon.ino b/examples/Cylon/Cylon.ino index 5291d79..936b232 100644 --- a/examples/Cylon/Cylon.ino +++ b/examples/Cylon/Cylon.ino @@ -1,6 +1,5 @@ -//Cylon demo for OctoFLED +//Cylon demo for OctoFLED Raw (without FastLED) #include -#include // How many leds in your strip? #define NUM_LEDS 32 @@ -8,8 +7,8 @@ // For led chips like Neopixels, which have a data line, ground, and power, you just // need to define DATA_PIN. Or list of pins for parallel connections to your LED device. uint8_t DATA_PIN[1] = { 17 }; -// Define the array of leds -CRGB leds[NUM_LEDS]; +// Define the array of leds, 3 bytes per +uint8_t leds[NUM_LEDS*3]; // Define the display object with 8-pixel serpentine on 8x8 plane ObjectFLED cylon( NUM_LEDS, leds, CORDER_GRB, sizeof(DATA_PIN), DATA_PIN, 8); void setup() { @@ -17,21 +16,21 @@ void setup() { cylon.setBrightness(84); } -CRGB dotColor = 0xff0000; +const uint8_t dotColor[3] = { 0xFF, 0, 0 }; //R, G, B const int delayT = 25; const int fadeAmt = 40; void loop() { - for( int i=0; i=0; i--) { - leds[i] = dotColor; + for( int i=(NUM_LEDS-1)*3; i>=0; i-=3) { + memcpy(&leds[i], &dotColor, 3); cylon.show(); - fadeToBlackBy(leds, NUM_LEDS, fadeAmt); + fadeToColorBy(leds, NUM_LEDS, 0 ,fadeAmt); delay(delayT); } delay(delayT);