Created
June 9, 2016 20:30
-
-
Save LimeBlast/de98f0f5c18ed6b87361e30060a2a596 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* Include the HCWS2812 library */ | |
#include "HCWS2812.h" | |
/* Create an instance of the library */ | |
HCWS2812 HCWS2812; | |
void setup() | |
{ | |
/* Set the R,G,B background colours to zero */ | |
HCWS2812.SetBG(55, 55, 55); | |
/* Clear the output buffer */ | |
HCWS2812.ClearBuffer(); | |
} | |
/* Main program */ | |
void loop() | |
{ | |
int i = random(NUMBEROFLEDS); | |
int j; | |
HCWS2812.ClearBuffer(); | |
/* quick fade in */ | |
for(j = 0; j < 40; j++) | |
{ | |
RGBBuffer[RED][i] = j * 5 + 55; | |
RGBBuffer[GREEN][i] = j * 5 + 55; | |
RGBBuffer[BLUE][i] = j * 5 + 55; | |
HCWS2812.Refresh(); | |
delay(10); | |
} | |
/* slow fade out */ | |
for(j = 40; j; j--) | |
{ | |
HCWS2812.ClearBuffer(); | |
RGBBuffer[RED][i] = j * 5 + 55; | |
RGBBuffer[GREEN][i] = j * 5 + 55; | |
RGBBuffer[BLUE][i] = j * 5 + 55; | |
HCWS2812.Refresh(); | |
delay(80); | |
} | |
HCWS2812.ClearBuffer(); | |
HCWS2812.Refresh(); | |
delay(200); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment