Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- #define NUM_LEDS 256
- #define DATA_PIN 12
- CRGB leds[NUM_LEDS];
- void setup() {
- FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
- FastLED.setBrightness(8);
- }
- int Arduino[8][32]{
- {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},
- {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},
- {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},
- {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},
- {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},
- {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},
- {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},
- {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},
- };
- void loop() {
- unsigned long startTime = millis();
- unsigned long delayTime = 1000; // Adjust the delay time in milliseconds
- // Turn on LEDs in the opposite direction
- while (millis() - startTime < delayTime) {
- for (int j = 31; j >= 0; j--) {
- for (int i = 7; i >= 0; i--) {
- if (!(j & 1) && Arduino[i][j] == 0)
- leds[j * 8 + i] = CRGB(0, 0, 0);
- if (!(j & 1) && Arduino[i][j] != 0)
- leds[j * 8 + i] = CHSV(Arduino[i][j], 255, 255);
- if (j & 1 && Arduino[i][j] == 0)
- leds[j * 8 + 7 - i] = CRGB(0, 0, 0);
- if (j & 1 && Arduino[i][j] != 0)
- leds[j * 8 + 7 - i] = CHSV(Arduino[i][j], 255, 255);
- }
- FastLED.show();
- delay(0);
- }
- }
- // Turn off LEDs in the opposite direction
- for (int j = 31; j >= 0; j--) {
- for (int i = 7; i >= 0; i--) {
- if (!(j & 1))
- leds[j * 8 + i] = CRGB(0, 0, 0);
- if (j & 1)
- leds[j * 8 + 7 - i] = CRGB(0, 0, 0);
- }
- FastLED.show();
- delay(0); // Adjust delay if needed
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment