Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include <FastLED.h>
  2.  
  3. #define LEDPIN 8
  4. #define NUMOFLEDS 32*8
  5. #define width 32
  6. #define height 8
  7.  
  8. CRGB leds[NUMOFLEDS];
  9.  
  10. void setup() {
  11.  
  12. FastLED.addLeds<WS2812, LEDPIN, GRB>(leds, NUMOFLEDS);
  13.  
  14. }
  15.  
  16. void LED(int hg, int wt, int r , int g, int b){ //THIS ALLOW YOU TO USE CARTESIAN COORDINATES
  17. if ( hg % 2 == 0){
  18. leds[wt + hg * 32] = CRGB(r,g,b);
  19. FastLED.show();
  20. } else {
  21. leds[(31 - wt) + hg * 32] = CRGB(r,g,b);
  22. FastLED.show();
  23. }
  24. }
  25.  
  26. int led = 0;
  27. int i,j;
  28. void loop() {
  29. FastLED.clear();
  30. for ( i = 0; i < width ; i ++){
  31. for( j = 0; j < height; j++){
  32. LED(j,i,16,16,16);
  33. //delay(1);
  34. }
  35. //delay(1);
  36. }
  37. //delay(1);
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement