Initial A works

This commit is contained in:
Peter 2019-12-27 19:32:03 +01:00
commit a4c19fa2f7
1 changed files with 89 additions and 0 deletions

89
display/display.ino Normal file
View File

@ -0,0 +1,89 @@
#include <FastLED.h>
#define NUM_LEDS 512
#define DATA_PIN 16
CRGB leds[NUM_LEDS];
/*unsigned char x=0;
unsigned char y=0;*/
void printChar(unsigned char line,unsigned char pos, char character);
unsigned PROGMEM short led_map[32][16] = {{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
{31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16},
{32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47},
{63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48},
{64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79},
{95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80},
{96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111},
{127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112},
{128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143},
{159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144},
{160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175},
{191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176},
{192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207},
{223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208},
{224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239},
{255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240},
{256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271},
{287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272},
{288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303},
{319, 318, 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, 305, 304},
{320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335},
{351, 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, 337, 336},
{352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367},
{383, 382, 381, 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, 368},
{384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399},
{415, 414, 413, 412, 411, 410, 409, 408, 407, 406, 405, 404, 403, 402, 401, 400},
{416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431},
{447, 446, 445, 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, 432},
{448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463},
{479, 478, 477, 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, 466, 465, 464},
{480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495},
{511, 510, 509, 508, 507, 506, 505, 504, 503, 502, 501, 500, 499, 498, 497, 496}};
const PROGMEM unsigned char A[] = {
0b00000000,
0b00001100,
0b00010010,
0b00010010,
0b00011110,
0b00010010,
0b00010010,
0b00000000};
void setup(){
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds,NUM_LEDS);
Serial.begin(9600);
Serial.println("Setup Done");
}
void loop(){
Serial.println("Loop entry");
/*leds[led_map[x][y]].setRGB(0,(y*32+x)/2,0);
x++;
if(x>=32){
y++;
x=0;
}
if(y>=16)y=0;*/
for(int line=0;line<2;line++)
for(int pos=0;pos<5;pos++)
printChar(line,pos,'A');
Serial.println("LEDs set up");
FastLED.show();
delay(250);
}
void printChar(unsigned char line,unsigned char pos, char character){
const PROGMEM unsigned char start=0b00100000;
if(line>1)
return;
if(pos>4)
return;
for(char x=0;x<6;x++){
for(char y=0;y<8;y++){
leds[led_map[pos*6+x][line*8+y]].setRGB(0,0,(A[y]&(start>>x) ? 127 : 0));
}
}
}