Advertisement
KelvinMead

testing crgb arrays

Apr 21st, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. #include <FastLED.h>
  2.  
  3. #define NUM_LEDS_IN_SEGMENT 2
  4. #define NUM_SIDES 4
  5.  
  6. #define NUM_LEDS 12
  7. #define DATA_PIN 3
  8. #define CLOCK_PIN 13
  9. #define BRIGHTNESS 255
  10.  
  11.  
  12. struct CRGB sideLeds[NUM_LEDS_IN_SEGMENT * NUM_SIDES];
  13.  
  14. byte sideState[6][4] = {
  15. {4, 6, 2, 5}, // 1 0,1
  16. {5, 1, 6, 3}, // 2 2,3
  17. {5, 2, 6, 4}, // 3 4,5
  18. {3, 6, 1, 5}, // 4 6,7
  19. {4, 1, 2, 3}, // 5 8,9
  20. {3, 2, 1, 4} // 6 10,11
  21. };
  22.  
  23. int state = 1;
  24.  
  25. void setup() {
  26. // put your setup code here, to run once:
  27. Serial.begin(9600); // start serial for output
  28. // FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, BRG>(leds, NUM_LEDS);
  29. FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, BRG>(sideLeds, NUM_LEDS_IN_SEGMENT*NUM_SIDES);
  30. FastLED.clear();
  31. FastLED.setBrightness(BRIGHTNESS);
  32. }
  33.  
  34. void loop() {
  35. // for (int i = 0; i < NUM_LEDS_IN_SEGMENT*NUM_SIDES; i+=NUM_LEDS) {
  36. // for (int j=0; j < NUM_LEDS_IN_SEGMENT; j++) {
  37. for (int k=0; k<NUM_SIDES; k++) {
  38.  
  39. sideLeds[0] = (sideState[0][0]);
  40.  
  41. Serial.print(sideLeds[0]);
  42.  
  43. // sideLeds[i+1] = (sideState[state-1][i/2]*NUM_LEDS_IN_SEGMENT)+(j-2);
  44. }
  45. // }
  46.  
  47. // 4 6 2 5
  48. // 6,7 10,11 2,3 8,9
  49.  
  50. //for (int x=0; x<NUM_LEDS_IN_SEGMENT*NUM_SIDES; x++) {
  51. // Serial.print(sideLeds[0]);
  52. // }
  53. Serial.println();
  54.  
  55. }
  56.  
  57.  
  58. // for (int i=0; i<NUM_LEDS_IN_SEGMENT*NUM_SIDES; i++) {
  59. // sideLeds[i] = CRGB( 0, 255, 0 );
  60. // }
  61. // FastLED.show();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement