/*
LED NUMBERS:
33 0 1 2 3 4 71 38 39 40 41 42 109 76 77 78 79 80 147 114 115 116 117 118 185 152 153 154 155 156 223 190 191 192 193 194
32 5 70 43 108 81 146 119 184 157 222 195
31 6 69 44 107 82 145 120 183 158 221 196
30 7 68 45 106 83 144 121 182 159 220 197
29 8 67 46 105 84 143 122 181 160 219 198
28 9 66 47 104 85 142 123 180 161 218 199
27 34 35 36 37 10 65 72 73 74 75 48 103 110 111 112 113 86 141 148 149 150 151 124 179 186 187 188 189 162 217 224 225 226 227 200
26 11 64 49 102 87 140 125 178 163 216 201
25 12 63 50 101 88 139 126 177 164 215 202
24 13 62 51 100 89 138 127 176 165 214 203
23 14 61 52 99 90 137 128 175 166 213 204
22 15 60 53 98 91 136 129 174 167 212 205
21 20 19 18 17 16 59 58 57 56 55 54 97 96 95 94 93 92 135 134 133 132 131 130 173 172 171 170 169 168 211 210 209 208 207 206
*/
/*******************************************************************************
Noiasca Neopixel Display
01 Hello World
Simple Strandtest/Hello World program to check the wiring of your display
http://werner.rothschopf.net/202005_arduino_neopixel_display_en.htm
by noiasca
2020-05-04
*******************************************************************************/
#include "FastLED.h"
const byte ledPin = 4; // Which pin on the Arduino is connected to the NeoPixels?
const byte numDigits = 6; // How many digits (numbers) are available on your display?
const byte pixelPerDigit = 38; // all pixel, including decimal point pixels if available at each digit
const byte NUM_LEDS = numDigits * pixelPerDigit;
#define DATA_PIN 3
#define CLOCK_PIN 13
CRGB leds[NUM_LEDS];
/*
Segments are named and orded like this
SEG_A
SEG_F SEG_B
SEG_G
SEG_E SEG_C
SEG_D SEG_DP
in the following constant array you have to define
which pixels belong to which segment
*/
const uint16_t ledCount(pixelPerDigit * numDigits * 3 );
typedef uint64_t segsize_t; // define the type of segsize_t to 64bit
#define B64(b) (1ULL << (b)) // remark: don't use the _BV(n) nor bit() makro for 64 bit variables
const segsize_t segment[8] {
/*
* * * * * *
* *
* *
* *
* *
* *
* * * * * *
* *
* *
* *
* *
* *
* * * * * *
*/
B64(33) | B64( 0) | B64( 1) | B64( 2) | B64( 3) | B64( 4), // SEG_A
B64( 4) | B64( 5) | B64( 6) | B64( 7) | B64( 8) | B64( 9) | B64(10), // SEG_B
B64(10) | B64(11) | B64(12) | B64(13) | B64(14) | B64(15) | B64(16), // SEG_C
B64(16) | B64(17) | B64(18) | B64(19) | B64(20) | B64(21), // SEG_D
B64(21) | B64(22) | B64(23) | B64(24) | B64(25) | B64(26) | B64(27), // SEG_E
B64(27) | B64(28) | B64(29) | B64(30) | B64(31) | B64(32) | B64(33), // SEG_F
B64(34) | B64(35) | B64(36) | B64(37), // SEG_G
B64(35) | B64(36) | B64(37) | B64(38), // SEG_DP
};
const segsize_t segment1[8] {
B64(33) | B64( 0) | B64( 1) | B64( 2) | B64( 3) | B64( 4) | B64( 5) | B64( 6) | B64( 7) | B64( 8) | B64( 9) | B64(10)
| B64(34) | B64(35) | B64(36) | B64(37) | B64(27) | B64(28) | B64(29) | B64(30) | B64(31) | B64(32),
B64(35) | B64(36) | B64(37) | B64(38), // SEG_DP
/*
* * * * * *
* *
* *
* *
* *
* *
* * * * * *
. .
. .
. .
. .
. .
. . . . . .
*/
};
const segsize_t segment2[8] {
/*
. . . . . .
. .
. .
. .
. .
. .
* * * * * *
* *
* *
* *
* *
* *
* * * * * *
*/
B64(10) | B64(11) | B64(12) | B64(13) | B64(14) | B64(15) | B64(16) | B64(17) | B64(18) | B64(19) | B64(20) | B64(21) |
B64(22) | B64(23) | B64(24) | B64(25) | B64(26) | B64(27) | B64(34) | B64(35) | B64(36) | B64(37),
B64(35) | B64(36) | B64(37) | B64(38), // SEG_DP
};
// const uint16_t ledCount(pixelPerDigit * numDigits); // keeps track of used pixels
#include "Adafruit_NeoPixel.h" // install Adafruit library from library manager
Adafruit_NeoPixel strip(ledCount, ledPin, NEO_GRB + NEO_KHZ800); // create Neopixel object like commonly used with Adafruit
#include "Noiasca_NeopixelDisplay.h" // download library from: http://werner.rothschopf.net/202005_arduino_neopixel_display_en.htm
Noiasca_NeopixelDisplay display(strip, segment, numDigits, pixelPerDigit); // create display object, handover the name of your strip as first parameter
Noiasca_NeopixelDisplay display1(strip, segment1, numDigits, pixelPerDigit);
Noiasca_NeopixelDisplay display2(strip, segment2, numDigits, pixelPerDigit);
/* A or char(65) is SEG A
B or char(66) is SEG B
C or char(67) is SEG C
D or char(68) is SEG D
E or char(69) is SEG E
F or char(70) is SEG F
G or char(71) is SEG G
*/
void setup() {
strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
strip.show(); // Turn OFF all pixels ASAP
strip.setBrightness(250); // Set BRIGHTNESS to about 1/5 (max = 255)
FastLED.addLeds<NEOPIXEL, ledPin>(leds, NUM_LEDS); // GRB ordering is assumed
}
void loop() {
// display1.print(String(char(65)) + String(char(65)) + String(char(65)) + String(char(65)) + String(char(65)) + String(char(65))); // print 1234 to your display
// delay(3);
// display2.print(String(char(65)) + String(char(65)) + String(char(65)) + String(char(65)) + String(char(65)) + String(char(65))); // print 1234 to your display
// delay(3);
showAllLeds();
}
void showAllLeds()
{
leds[33] = CRGB::Red;
FastLED.show();
delay(5);
for (int i = 0; i <= 4; i++)
{
leds[i] = CRGB::Red;
FastLED.show();
delay(5);
}
leds[71] = CRGB::Red;
FastLED.show();
delay(5);
for (int i = 38; i <= 42; i++)
{
leds[i] = CRGB::Red;
FastLED.show();
delay(5);
}
leds[109] = CRGB::Red;
FastLED.show();
delay(5);
for (int i = 76; i <= 80; i++)
{
leds[i] = CRGB::Red;
FastLED.show();
delay(5);
}
leds[147] = CRGB::Red;
FastLED.show();
delay(147);
for (int i = 114; i <= 118; i++)
{
leds[i] = CRGB::Red;
FastLED.show();
delay(5);
}
leds[185] = CRGB::Red;
FastLED.show();
delay(5);
for (int i = 152; i <= 156; i++)
{
leds[i] = CRGB::Red;
FastLED.show();
delay(5);
}
leds[223] = CRGB::Red;
FastLED.show();
delay(5);
for (int i = 190; i <= 194; i++)
{
leds[i] = CRGB::Red;
FastLED.show();
delay(5);
}
for (int i = 195; i <= 206; i++)
{
leds[i] = CRGB::Red;
FastLED.show();
delay(5);
}
for (int i = 207; i <= 211; i++)
{
leds[i] = CRGB::Red;
FastLED.show();
delay(5);
}
for (int i = 168; i <= 173; i++)
{
leds[i] = CRGB::Red;
FastLED.show();
delay(5);
}
for (int i = 130; i <= 135; i++)
{
leds[i] = CRGB::Red;
FastLED.show();
delay(5);
}
for (int i = 92; i <= 97; i++)
{
leds[i] = CRGB::Red;
FastLED.show();
delay(5);
}
for (int i = 54; i <= 59; i++)
{
leds[i] = CRGB::Red;
FastLED.show();
delay(5);
}
for (int i = 16; i <= 32; i++)
{
leds[i] = CRGB::Red;
FastLED.show();
delay(5);
}
leds[33] = CRGB::Black;
FastLED.show();
delay(5);
for (int i = 0; i <= 4; i++)
{
leds[i] = CRGB::Black;
FastLED.show();
delay(5);
}
leds[71] = CRGB::Black;
FastLED.show();
delay(5);
for (int i = 38; i <= 42; i++)
{
leds[i] = CRGB::Black;
FastLED.show();
delay(5);
}
leds[109] = CRGB::Black;
FastLED.show();
delay(5);
for (int i = 76; i <= 80; i++)
{
leds[i] = CRGB::Black;
FastLED.show();
delay(5);
}
leds[147] = CRGB::Black;
FastLED.show();
delay(147);
for (int i = 114; i <= 118; i++)
{
leds[i] = CRGB::Black;
FastLED.show();
delay(5);
}
leds[185] = CRGB::Black;
FastLED.show();
delay(5);
for (int i = 152; i <= 156; i++)
{
leds[i] = CRGB::Black;
FastLED.show();
delay(5);
}
leds[223] = CRGB::Black;
FastLED.show();
delay(5);
for (int i = 190; i <= 194; i++)
{
leds[i] = CRGB::Black;
FastLED.show();
delay(5);
}
for (int i = 195; i <= 206; i++)
{
leds[i] = CRGB::Black;
FastLED.show();
delay(5);
}
for (int i = 207; i <= 211; i++)
{
leds[i] = CRGB::Black;
FastLED.show();
delay(5);
}
for (int i = 168; i <= 173; i++)
{
leds[i] = CRGB::Black;
FastLED.show();
delay(5);
}
for (int i = 130; i <= 135; i++)
{
leds[i] = CRGB::Black;
FastLED.show();
delay(5);
}
for (int i = 92; i <= 97; i++)
{
leds[i] = CRGB::Black;
FastLED.show();
delay(5);
}
for (int i = 54; i <= 59; i++)
{
leds[i] = CRGB::Black;
FastLED.show();
delay(5);
}
for (int i = 16; i <= 32; i++)
{
leds[i] = CRGB::Black;
FastLED.show();
delay(5);
}
}