Skip to content

Instantly share code, notes, and snippets.

View marmilicious's full-sized avatar

Marc Miller marmilicious

  • Glendale, California
View GitHub Profile
For Bill from this post:
https://plus.google.com/u/0/109149766109138486006/posts/J9Xnqthpgsh
//---------------------------------------------------------------
Somewhere at the top of the program:
#define NUM_LEDS 32 //length of one strip
#define DBL_LEDS NUM_LEDS*2 //double the length of one strip
CRGB ledsA[NUM_LEDS]; //strip A (gets displayed)
//Fading up and down using fadeLightBy
//by Scott Kletzien
/*
Put together & tested by:
Scottie Digital
*/
#include "FastLED.h"
#define NUM_LEDS 288 // # of LEDS in the strip
//***************************************************************
// Quick example of lighting up blocks of pixels
//
// Marc Miller, Aug 2017
//***************************************************************
#include "FastLED.h"
#define LED_TYPE LPD8806
#define DATA_PIN 11
#define CLOCK_PIN 13
Originally from this post:
https://plus.google.com/100542328320334100166/posts/Y5BdWFEvfo1
Copied here since G+ is going away.
-----------------------------------------------------------------------
When using fill_rainbow...
To make the rainbow flow go the other way you can multiply the millis bit by -1:
change this:
fill_rainbow( leds[x], stripLength, millis()/2, 256/stripLength );
Info posted for this post:
https://plus.google.com/101381095273549449891/posts/FqmG6S4rjpz
Another option (that uses a bit more memory) is to use a second array (let's call it leds_display) that
you copy your leds data to with the offset before displaying. So it the top of your program you will
have two CRGB arrays:
CRGB leds[NUM_LEDS]; //working array
CRGB leds_display[NUM_LEDS]; //array that gets displayed
const uint8_t ppm = 150; //pixels per matrix
//You can do something like this to simply copy the data to the other matrices as the first matrix is filled in.
for (uint16_t i=0; i<ppm; i++) {
leds[i] = CHSV(random8(),255,255);
// copy to other matrices
ff00 0000 ff00 0000 ffff 00ff 00ff ffff
ff00 0000 00ff ffff a0a0 a480 8080 8080
8080 8080 8080 8080 8080 a0a0 a4a0 a0a4
a0a0 a4a0 a0a4 a0a0 a4a0 a0a4 8080 8080
8080 8080 80a0 a0a4 a0a0 a4a0 a0a4 8080
8080 8080 a0a0 a4a0 a0a4 a0a0 a4a0 a0a4
7f9f 5555 5f55 555f 557f 7f55 7f7f 5580
8080 a0a0 a4a0 a0a4 7f7f 557f 5f55 a0a0
a4a0 a0a4 8080 807f 9f55 557f 5555 5f55
7fbf 55aa bf55 aadf 55aa bf55 aa9f 5580
//***************************************************************
// Untested code
// For reading R,G,B serial data sent from computer to LED controller.
//
//***************************************************************
//serial read of data to feed to FastLED
#include "FastLED.h"
//setup LEDs
//***************************************************************
// Delayed duplicate pattern using timer experiment.
//
// This example displays a pattern on the first half of a strip
// (call it section A) and then the same pattern is displayed
// on the second half of the strip (section B) but it's start
// time is delayed by a specified amount of time.
//
// Marc Miller, Feb 2017
//***************************************************************
//***************************************************************
// Example for Michael Sime with button added.
//
// Each time button is pressed the next palette is selected.
// Open the serial monitor to see some feedback.
// Pixel zero will also flash bright purple each time the button
// is pressed as a visual feedback.
//
// Search for "BUTTON STUFF" to find the various button releated
// lines of code that were put in place.