Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- #define NUM_LEDS_IN_SEGMENT 2
- #define NUM_SIDES 4
- #define NUM_LEDS 12
- #define DATA_PIN 3
- #define CLOCK_PIN 13
- #define BRIGHTNESS 255
- struct CRGB sideLeds[NUM_LEDS_IN_SEGMENT * NUM_SIDES];
- byte sideState[6][4] = {
- {4, 6, 2, 5}, // 1 0,1
- {5, 1, 6, 3}, // 2 2,3
- {5, 2, 6, 4}, // 3 4,5
- {3, 6, 1, 5}, // 4 6,7
- {4, 1, 2, 3}, // 5 8,9
- {3, 2, 1, 4} // 6 10,11
- };
- int state = 1;
- void setup() {
- // put your setup code here, to run once:
- Serial.begin(9600); // start serial for output
- // FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, BRG>(leds, NUM_LEDS);
- FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, BRG>(sideLeds, NUM_LEDS_IN_SEGMENT*NUM_SIDES);
- FastLED.clear();
- FastLED.setBrightness(BRIGHTNESS);
- }
- void loop() {
- // for (int i = 0; i < NUM_LEDS_IN_SEGMENT*NUM_SIDES; i+=NUM_LEDS) {
- // for (int j=0; j < NUM_LEDS_IN_SEGMENT; j++) {
- for (int k=0; k<NUM_SIDES; k++) {
- sideLeds[0] = (sideState[0][0]);
- Serial.print(sideLeds[0]);
- // sideLeds[i+1] = (sideState[state-1][i/2]*NUM_LEDS_IN_SEGMENT)+(j-2);
- }
- // }
- // 4 6 2 5
- // 6,7 10,11 2,3 8,9
- //for (int x=0; x<NUM_LEDS_IN_SEGMENT*NUM_SIDES; x++) {
- // Serial.print(sideLeds[0]);
- // }
- Serial.println();
- }
- // for (int i=0; i<NUM_LEDS_IN_SEGMENT*NUM_SIDES; i++) {
- // sideLeds[i] = CRGB( 0, 255, 0 );
- // }
- // FastLED.show();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement