-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConstants.h
53 lines (43 loc) · 1.55 KB
/
Constants.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <FastLED.h>
#define NUM_STRIPS 5 //number of LED strips
#define NUM_LEDS 300 //number of LEDs per strip
// LED Strip Pin Addresses
#define STRIP1_PIN 2
#define STRIP2_PIN 3
#define STRIP3_PIN 4
#define STRIP4_PIN 5
#define STRIP5_PIN 6
// Frame Speed is the number of milliseconds between frames. This is an int declaration so it can be changed
int FRAME_SPEED = 25;
//LED strip
// This is an array of an array of leds. One item for each led in your strip.
CRGB leds[NUM_STRIPS][NUM_LEDS];
void setupLEDStrips() {
//FastLED.addLeds<NEOPIXEL, PIN>(leds, NUM_LEDS);
// sanity check delay - allows reprogramming if accidently blowing power w/leds
FastLED.delay(2000);
//This initializes the LED NUM_STRIPS
FastLED.addLeds<WS2812B, STRIP1_PIN, RGB>(leds[0], NUM_LEDS);
FastLED.addLeds<WS2812B, STRIP2_PIN, RGB>(leds[1], NUM_LEDS);
FastLED.addLeds<WS2812B, STRIP3_PIN, RGB>(leds[2], NUM_LEDS);
FastLED.addLeds<WS2812B, STRIP4_PIN, RGB>(leds[3], NUM_LEDS);
FastLED.addLeds<WS2812B, STRIP5_PIN, RGB>(leds[4], NUM_LEDS);
FastLED.setBrightness(50);
FastLED.show();
}
unsigned long lastFrame = 0;
void showFrame()
{
unsigned long frameDelta = millis() - lastFrame;
// only wait for the time remaining on this frame
if (frameDelta < FRAME_SPEED)
{
FastLED.delay(FRAME_SPEED - frameDelta);
}
// we've already spent longer on this frame than we ever meant to wait
else
{
FastLED.show();
}
lastFrame = millis();
}