Last active
November 20, 2022 15:19
-
-
Save chemdoc77/31632b540908b6788c9340989eeb8bfc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Testing FastLED's CRGBSet array with a fill the whole array function and with a colorwipe function | |
// by Chemdoc77 | |
#include "FastLED.h" | |
#define NUM_LEDS 24 | |
#define Data_Pin 6 | |
#define chipset NEOPIXEL | |
#define BRIGHTNESS 50 | |
CRGB rawleds[NUM_LEDS]; | |
CRGBSet leds(rawleds, NUM_LEDS); | |
CRGBSet leds1(leds(0,7)); | |
CRGBSet leds2(leds(8,15)); | |
CRGBSet leds3(leds(16,23)); | |
struct CRGB * ledarray[] ={leds1, leds2, leds3}; // An array of the CRGBSet arrays | |
uint8_t sizearray[]= {8,8,8}; // size of the above arrays | |
void setup() { | |
delay(2000); // power-up safety delay | |
FastLED.addLeds<chipset, Data_Pin>(leds, NUM_LEDS); | |
FastLED.setBrightness(BRIGHTNESS); | |
FastLED.setMaxPowerInVoltsAndMilliamps(5,1500); | |
set_max_power_indicator_LED(13); | |
} | |
void loop() { | |
// fills the whole array | |
CD77_arrayfill(CRGB::Blue, 700); | |
CD77_arrayfill(CRGB::Red, 700); | |
// Fills one dot at a time | |
CD77_colorwipe_dot(0, CRGB::Blue, 200); | |
CD77_colorwipe_dot(1, CRGB::Red, 200); | |
CD77_colorwipe_dot(2, CRGB::Green, 200); | |
} | |
//================ New Functions ===================== | |
void CD77_colorwipe_dot(uint8_t y, CRGB color, uint32_t wait) { //Note: y is ledarray number | |
for (uint8_t x = 0; x < sizearray[y]; x++) { | |
ledarray[y][x] = color; | |
FastLED.delay(wait); | |
ledarray[y][x] =CRGB::Black; | |
} | |
} | |
void CD77_arrayfill(CRGB color, uint16_t wait){ | |
for (uint8_t x=0; x<3; x++){ | |
fill_solid(ledarray[x], sizearray[x], color); | |
FastLED.show(); | |
delay(wait); | |
fill_solid( ledarray[x], sizearray[x], CRGB::Black); | |
FastLED.show(); | |
} | |
} |
Author
chemdoc77
commented
Nov 20, 2022
via email
Hi goinheix - Thank you for your nice comments about my posts. As to your
question, I only know how to set up the CRGBSet arrays manually. Nice
thing about FastLED sketches is that you can experiment with different
ideas. Also, I would recommend that you post your question on r/FastLED.
Best Regards,
Chemdoc77
…On Fri, Nov 18, 2022 at 7:34 PM goinheix ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Hi, I've been reading your replies on every forum about FastLED and
they've helped me a lot, so thank you. I have a question:
On lines 11-15 you declare some CRGBSet arrays. I need to do the same but
they are 100 (it's contiguous groups of 2 LEDs on a 200 LED strip). Should
I do this manually or is there a way of making it through a loop?
Thank you!
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/31632b540908b6788c9340989eeb8bfc#gistcomment-4374530>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHLGTM22OOQH5CJDJEMWC3WJAVCLBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVA3TGOBYGQZTEMNHORZGSZ3HMVZKMY3SMVQXIZI>
.
You are receiving this email because you authored a thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment