Guest User

Untitled

a guest
Nov 25th, 2023
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.80 KB | None | 0 0
  1. #include <FastLED.h>
  2. #define NUM_LEDS 256
  3. #define DATA_PIN 12
  4. CRGB leds[NUM_LEDS];
  5.  
  6. void setup() {
  7. FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
  8. FastLED.setBrightness(8);
  9. }
  10.  
  11. int Arduino[8][32]{
  12. {0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000},
  13. {0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000},
  14. {0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000},
  15. {0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000},
  16. {0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000},
  17. {0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000},
  18. {0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000},
  19. {0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x008000, 0x008000, 0x000000, 0x000000, 0x000000},
  20. };
  21.  
  22. void loop() {
  23. unsigned long startTime = millis();
  24. unsigned long delayTime = 1000; // Adjust the delay time in milliseconds
  25.  
  26. // Turn on LEDs in the opposite direction
  27. while (millis() - startTime < delayTime) {
  28. for (int j = 31; j >= 0; j--) {
  29. for (int i = 7; i >= 0; i--) {
  30. if (!(j & 1) && Arduino[i][j] == 0)
  31. leds[j * 8 + i] = CRGB(0, 0, 0);
  32. if (!(j & 1) && Arduino[i][j] != 0)
  33. leds[j * 8 + i] = CHSV(Arduino[i][j], 255, 255);
  34. if (j & 1 && Arduino[i][j] == 0)
  35. leds[j * 8 + 7 - i] = CRGB(0, 0, 0);
  36. if (j & 1 && Arduino[i][j] != 0)
  37. leds[j * 8 + 7 - i] = CHSV(Arduino[i][j], 255, 255);
  38. }
  39. FastLED.show();
  40. delay(0);
  41. }
  42. }
  43.  
  44. // Turn off LEDs in the opposite direction
  45. for (int j = 31; j >= 0; j--) {
  46. for (int i = 7; i >= 0; i--) {
  47. if (!(j & 1))
  48. leds[j * 8 + i] = CRGB(0, 0, 0);
  49. if (j & 1)
  50. leds[j * 8 + 7 - i] = CRGB(0, 0, 0);
  51. }
  52. FastLED.show();
  53. delay(0); // Adjust delay if needed
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment