Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- //#include <string.h>
- #define DATA_PIN 5
- #define CLOCK_PIN 6
- #define COLOR_ORDER GRB
- #define CHIPSET WS2812
- #define NUM_LEDS 453
- #define BRIGHTNESS 40
- CRGB leds[NUM_LEDS];
- unsigned long Timer;
- void setup() {
- delay(3000); // sanity delay
- FastLED.addLeds<CHIPSET, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);
- FastLED.setBrightness( BRIGHTNESS );
- FastLED.setCorrection( CRGB( 255, 230, 240) );
- Timer=millis();
- }
- void loop() {
- if (millis()-Timer>=15) { //15*70=1050 so a pause of 15 millis results in 70 Frames per second aprroximatly
- Timer=millis();
- drawrings();
- FastLED.show();
- }
- }
- void drawrings()
- {
- static byte framecounter;
- int lp1=0; //startposition ring 1
- int lp2=80; //startposition ring 2
- int lp3=151; //startposition ring 3
- int lp4=215; //startposition ring 4
- int lp5=271; //startposition ring 5
- int lp6=318; //startposition ring 6
- int lp7=357; //startposition ring 7
- int lp8=388; //startposition ring 8
- int lp9=411; //startposition ring 9
- int lp10=427; //startposition ring 10
- int lg1=80; //size of ring 1
- int lg2=71; //size of ring 2
- int lg3=64; //size of ring 3
- int lg4=56; //size of ring 4
- int lg5=47; //size of ring 5
- int lg6=39; //size of ring 6
- int lg7=31; //size of ring 7
- int lg8=23; //size of ring 8
- int lg9=16; //size of ring 9
- int lg10=8; //size of ring 10
- int cw;
- int cwv;
- byte z;
- framecounter=framecounter+2;
- for(z=0; z<lg1; z++) { //draw ring 1
- cw=cubicwave8(z*1024/lg1+framecounter);
- cwv=cw*cw*cw/65536;
- leds[z+lp1]=CRGB(cwv,255-cwv,0);
- }
- for(z=0; z<lg2; z++ ) { //draw ring 2
- cw=cubicwave8(z*1024/lg2+framecounter+20);
- cwv=cw*cw*cw/65536;
- leds[z+lp2]=CRGB(cwv,255-cwv,0);
- }
- for(z=0; z<lg3; z++ ) { //draw ring 3
- cw=cubicwave8(z*1024/lg3+framecounter+40);
- cwv=cw*cw*cw/65536;
- leds[z+lp3]=CRGB(cwv,255-cwv,0);
- }
- for(z=0; z<lg4; z++ ) { //draw ring 4
- cw=cubicwave8(z*1024/lg4+framecounter+60);
- cwv=cw*cw*cw/65536;
- leds[z+lp4]=CRGB(cwv,255-cwv,0);
- }
- for(z=0; z<lg5; z++ ) { //draw ring 5
- cw=cubicwave8(z*1024/lg5+framecounter+80);
- cwv=cw*cw*cw/65536;
- leds[z+lp5]=CRGB(cwv,255-cwv,0);
- }
- for(z=0; z<lg6; z++ ) { //draw ring 6
- cw=cubicwave8(z*1024/lg6+framecounter+100);
- cwv=cw*cw*cw/65536;
- leds[z+lp6]=CRGB(cwv,255-cwv,0);
- }
- for(z=0; z<lg7; z++ ) { //draw ring 7
- cw=cubicwave8(z*1024/lg7+framecounter+120);
- cwv=cw*cw*cw/65536;
- leds[z+lp7]=CRGB(cwv,255-cwv,0);
- }
- for(z=0; z<lg8; z++ ) { //draw ring 8
- cw=cubicwave8(z*1024/lg8+framecounter+140);
- cwv=cw*cw*cw/65536;
- leds[z+lp8]=CRGB(cwv,255-cwv,0);
- }
- for(z=0; z<lg9; z++ ) { //draw ring 9
- cw=cubicwave8(z*1024/lg9+framecounter+160);
- cwv=cw*cw/256;
- leds[z+lp9]=CRGB(cwv,255-cwv,0);
- }
- for(z=0; z<lg10-3; z++ ) { //draw ring 10
- cw=cubicwave8(z*1024/lg10+framecounter+180);
- cwv=cw*cw/256;
- leds[z+lp10]=CRGB(cwv,255-cwv,0);
- }
- for (byte x=1;x<6;x=x+1) { //draw star
- leds[432+x]=CRGB(255-x*30,255-x*45,0);
- }
- leds[432]=CRGB(255,255,200);
- }
Advertisement
Add Comment
Please, Sign In to add comment