SHOW:
|
|
- or go back to the newest paste.
| 1 | #include "FastSPI_LED2.h" | |
| 2 | ||
| 3 | #define NUM_LEDS 16 | |
| 4 | - | #define DATA_PIN 6 |
| 4 | + | #define DATA_PIN 1 |
| 5 | ||
| 6 | CRGB leds[NUM_LEDS]; | |
| 7 | - | int ledsX[NUM_LEDS][3]; |
| 7 | + | |
| 8 | - | int BOTTOM_INDEX = 0; |
| 8 | + | |
| 9 | - | int TOP_INDEX = int(NUM_LEDS/2); |
| 9 | + | |
| 10 | - | int EVENODD = NUM_LEDS%2; |
| 10 | + | |
| 11 | void setup() {
| |
| 12 | FastLED.addLeds<WS2811, DATA_PIN, GRB>(leds, NUM_LEDS); | |
| 13 | - | int max_bright = 96; |
| 13 | + | |
| 14 | - | int idex = 0; |
| 14 | + | |
| 15 | - | int idx_offset = 0; |
| 15 | + | |
| 16 | void loop() {
| |
| 17 | - | static uint8_t startinghue = 0; |
| 17 | + | |
| 18 | - | int ibright = 0; |
| 18 | + | |
| 19 | - | int isat = 0; |
| 19 | + | |
| 20 | - | int bouncedirection = 0; |
| 20 | + | |
| 21 | - | float tcount = 0.0; |
| 21 | + | |
| 22 | - | int lcount = 0; |
| 22 | + | |
| 23 | } | |
| 24 | void simpleWave(float rate,int cycles,int wait, int hue) {
| |
| 25 | float pos = 0.0; | |
| 26 | - | FastLED.setBrightness(max_bright); |
| 26 | + | |
| 27 | pos = pos+rate; | |
| 28 | ||
| 29 | for (int i=0; i<NUM_LEDS;i++) {
| |
| 30 | float level = sin(i+pos) * 127 + 128; | |
| 31 | leds[i] = CHSV(hue,255,level); | |
| 32 | } | |
| 33 | ||
| 34 | FastLED.show(); | |
| 35 | delay(wait); | |
| 36 | } | |
| 37 | } | |
| 38 | ||
| 39 | void pacman(int reps, int wait) {
| |
| 40 | // pacman inspired animation - start yellow, moves towards power-pellet at top | |
| 41 | ||
| 42 | } | |
| 43 | void flicker(int thishue, int thissat, int reps) { //-m9-FLICKER EFFECT
| |
| 44 | for (int q = 0; q<=reps; q++) {
| |
| 45 | int random_bright = random(0,255); | |
| 46 | int random_delay = random(10,100); | |
| 47 | int random_bool = random(0,random_bright); | |
| 48 | if (random_bool < 10) {
| |
| 49 | for(int i = 0 ; i < NUM_LEDS; i++ ) {
| |
| 50 | leds[i] = CHSV(thishue, thissat, random_bright); | |
| 51 | } | |
| 52 | FastLED.show(); | |
| 53 | delay(random_delay); | |
| 54 | } | |
| 55 | } | |
| 56 | } | |
| 57 | void rainbow_loop(int istep, int idelay, int reps) {
| |
| 58 | for (int q=0;q<reps;q++) {
| |
| 59 | ||
| 60 | ihue = ihue+istep; | |
| 61 | fill_rainbow(&leds[0],NUM_LEDS,ihue); | |
| 62 | FastLED.show(); | |
| 63 | delay(idelay); | |
| 64 | } | |
| 65 | } | |
| 66 | void flame(int reps) {
| |
| 67 | for(int q=0; q<reps; q++){
| |
| 68 | float hmin = 0.1; float hmax = 45.0; | |
| 69 | float hdif = hmax-hmin; | |
| 70 | int randtemp = random(0,3); | |
| 71 | int rtop = random(10,NUM_LEDS); | |
| 72 | float hinc = (hdif/float(rtop))+randtemp; | |
| 73 | int ihue = hmin; | |
| 74 | fill_solid(&leds[0],NUM_LEDS,CHSV(0,0,0)); | |
| 75 | for(int i = 0; i < rtop; i++ ) {
| |
| 76 | ihue = ihue + hinc; | |
| 77 | leds[i] = CHSV(ihue, 255, 255); | |
| 78 | leds[rtop].r = 255; leds[rtop].g = 255; leds[rtop].b = 255; | |
| 79 | ||
| 80 | } | |
| 81 | FastLED.show(); | |
| 82 | int idelay = random(20,50); | |
| 83 | delay(idelay); | |
| 84 | } | |
| 85 | } |