This is a large 14″ 7 segment display that I made in a Marquee style using ws2812B programable leds and ping pong balls as diffusers.
Laserbox Pro – CO2 laser Cutter
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
//Counter. white digits with fade #include <FastLED.h> #define LED_PIN 3 #define NUM_LEDS 14 #define BRIGHTNESS 255 #define LED_TYPE WS2812B #define COLOR_ORDER GRB CRGBArray<NUM_LEDS> leds; #define UPDATES_PER_SECOND 1 CRGB alternateColor = CRGB::Black; short digitPattern[] = { 0b11111111111100, // 0 0b11000000001100, // 1 0b00111100111111, // 2 0b11110000111111, // 3 0b11000011001111, // 4 0b11110011110011, // 5 0b11111111110011, // 6 0b11000000111100, // 7 0b11111111111111, // 8 0b11110011111111, // 9 0b00000000000000, // 0b11001111111111, // A 0b11111111000011, // b 0b00111111110000, // C 0b11111100001111, // d 0b00111111110011, // E 0b00001111110011, // F 0b11110011111111, // g 0b11001111000011, // h 0b00001111000000, // I 0b11110000001100, // J }; void setup() { delay( 3000 ); FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip ); FastLED.setBrightness( BRIGHTNESS ); } void loop() { clearLeds(); delay(800); for(byte count = 0; count < 21 ; count++) { displayDigit(count, CRGB::White ); FastLED.show(); FastLED.delay(1000 / UPDATES_PER_SECOND); delay(100); FadeLeds(); } } void FadeLeds() { for(byte count3 = 0; count3 < 255 ; count3++) { leds.fadeToBlackBy(1); FastLED.show(); delay(1); } } void displayDigit(byte number, CRGB color) { for (byte i=0; i<14; i++){ leds[i] = ((digitPattern[number] & 1 << i) == 1 << i) ? color : alternateColor; } } void clearLeds() { for (int i=0; i<NUM_LEDS; i++) { leds[i] = CRGB::Black; } FastLED.show(); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
// Counter with color chase and fade. // #include <FastLED.h> #define LED_PIN 3 #define NUM_LEDS 14 #define BRIGHTNESS 255 #define LED_TYPE WS2812B #define COLOR_ORDER GRB CRGBArray<NUM_LEDS> leds; uint8_t colorIndex = 0; #define UPDATES_PER_SECOND 1 CRGB alternateColor = CRGB::Black; short digitPattern[] = { 0b11111111111100, // 0 0b11000000001100, // 1 0b00111100111111, // 2 0b11110000111111, // 3 0b11000011001111, // 4 0b11110011110011, // 5 0b11111111110011, // 6 0b11000000111100, // 7 0b11111111111111, // 8 0b11110011111111, // 9 0b11001111111111, // A 0b11111111000011, // b 0b00111111110000, // C 0b11111100001111, // d 0b00111111110011, // E 0b00001111110011, // F 0b11110011111111, // g 0b11001111000011, // h 0b00001111000000, // I 0b11110000001100, // J 0b00000000000000, // }; CRGBPalette16 currentPalette; TBlendType currentBlending; extern CRGBPalette16 myRedWhiteBluePalette; extern const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM; void setup() { delay( 3000 ); FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip ); FastLED.setBrightness( BRIGHTNESS ); currentPalette = RainbowColors_p; currentBlending = LINEARBLEND; } void loop() { clearLeds(); delay(800); colorIndex += 0; for(byte count = 0; count < 21 ; count++) { displayColorDigit(count, ColorFromPalette( currentPalette, colorIndex, BRIGHTNESS, currentBlending) ); FastLED.show(); for(byte count4 = 0; count4 < 3 ; count4++) { ColorChaseDigit(); } delay(500); FadeLeds(); } } void FadeLeds() { for(byte count3 = 0; count3 < 255 ; count3++) { leds.fadeToBlackBy(1); FastLED.show(); delay(1); } } void displayColorDigit(byte number, CRGB color) { for (byte i=0; i<14; i++){ if ((digitPattern[number] & 1 << i) == 1 << i) { leds[i]=ColorFromPalette( currentPalette, colorIndex, BRIGHTNESS, currentBlending); colorIndex += 5; } else { leds[i]=alternateColor; } } } void ColorChaseDigit() { for (byte i=0; i<14; i++){ if (leds[i]) { leds[i] = ColorFromPalette( currentPalette, colorIndex, BRIGHTNESS, currentBlending); FastLED.show(); delay(80); colorIndex += 10; } else { } } colorIndex += 10; } void clearLeds() { for (int i=0; i<NUM_LEDS; i++) { leds[i] = CRGB::Black; } FastLED.show(); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
// Counter with rainbow color segments #include <FastLED.h> #define LED_PIN 3 #define NUM_LEDS 14 #define BRIGHTNESS 255 #define LED_TYPE WS2812B #define COLOR_ORDER GRB CRGB leds[NUM_LEDS]; #define UPDATES_PER_SECOND 1 CRGB alternateColor = CRGB::Black; short digitPattern[] = { 0b11111111111100, // 0 0b11000000001100, // 1 0b00111100111111, // 2 0b11110000111111, // 3 0b11000011001111, // 4 0b11110011110011, // 5 0b11111111110011, // 6 0b11000000111100, // 7 0b11111111111111, // 8 0b11110011111111, // 9 0b00000000000000, // 0b11001111111111, // A 0b11111111000011, // b 0b00111111110000, // C 0b11111100001111, // d 0b00111111110011, // E 0b00001111110011, // F 0b11110011111111, // g 0b11001111000011, // h 0b00001111000000, // I 0b11110000001100, // J }; CRGBPalette16 currentPalette; TBlendType currentBlending; uint8_t colorIndex = 0; extern CRGBPalette16 myRedWhiteBluePalette; extern const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM; void setup() { delay( 3000 ); FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip ); FastLED.setBrightness( BRIGHTNESS ); currentPalette = RainbowColors_p; currentBlending = LINEARBLEND; } void loop() { clearLeds(); delay(800); for(byte count = 0; count < 21 ; count++) { displayDigit(count ); FastLED.show(); FastLED.delay(1000 / UPDATES_PER_SECOND); delay(100); } } void displayDigit(byte number) { for (byte i=0; i<14; i++){ leds[i] = ((digitPattern[number] & 1 << i) == 1 << i) ? ColorFromPalette( currentPalette, colorIndex, BRIGHTNESS, currentBlending) : alternateColor; colorIndex += 4; } } void clearLeds() { for (int i=0; i<NUM_LEDS; i++) { leds[i] = CRGB::Black; } FastLED.show(); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
//Multiple color digits with fade #include <FastLED.h> #define LED_PIN 3 #define NUM_LEDS 14 #define BRIGHTNESS 255 #define LED_TYPE WS2812B #define COLOR_ORDER GRB CRGBArray<NUM_LEDS> leds; #define UPDATES_PER_SECOND 1 CRGB alternateColor = CRGB::Black; short digitPattern[] = { 0b11111111111100, // 0 0b11000000001100, // 1 0b00111100111111, // 2 0b11110000111111, // 3 0b11000011001111, // 4 0b11110011110011, // 5 0b11111111110011, // 6 0b11000000111100, // 7 0b11111111111111, // 8 0b11110011111111, // 9 0b00000000000000, // 0b11001111111111, // A 0b11111111000011, // b 0b00111111110000, // C 0b11111100001111, // d 0b00111111110011, // E 0b00001111110011, // F 0b11110011111111, // g 0b11001111000011, // h 0b00001111000000, // I 0b11110000001100, // J }; CRGBPalette16 currentPalette; TBlendType currentBlending; extern CRGBPalette16 myRedWhiteBluePalette; extern const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM; void setup() { delay( 3000 ); FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip ); FastLED.setBrightness( BRIGHTNESS ); currentPalette = RainbowColors_p; currentBlending = LINEARBLEND; } void loop() { uint8_t colorIndex = 0; clearLeds(); delay(800); for(byte count = 0; count < 21 ; count++) { displayDigit(count, ColorFromPalette( currentPalette, colorIndex, BRIGHTNESS, currentBlending) ); colorIndex += 50; FastLED.show(); FastLED.delay(1000 / UPDATES_PER_SECOND); delay(100); FadeLeds(); } } void FadeLeds() { for(byte count3 = 0; count3 < 255 ; count3++) { leds.fadeToBlackBy(1); FastLED.show(); delay(1); } } void displayDigit(byte number, CRGB color) { for (byte i=0; i<14; i++){ leds[i] = ((digitPattern[number] & 1 << i) == 1 << i) ? color : alternateColor; } } void clearLeds() { for (int i=0; i<NUM_LEDS; i++) { leds[i] = CRGB::Black; } FastLED.show(); } |