Closed wchpikus closed 5 years ago
i try to display some text in 2'th zone, but something wrong..
What exactly is wrong? What do you see and what are you expecting to see?
Please use the <> to post your code as it is not being displayed properly - edit your original post. And it is better to post all the code instead of code fragments. Often the error is not where you think it is..
I do not see any example for use gig font and small at the same time
I can't do an example for everything. There is a point at which people take examples and combine to make them their own code. Also, the more complicated the examples the less useful they are.
hi I like to on 1 and 2 lines have big fonts, on 3 line 8x5 fonts. `
// Turn debugging on and off
// Define the main direction for scrolling double height. // if 1, scroll left; if 0, scroll right
// Hardware adaptation parameters for scrolling bool invertUpperZone = false; textEffect_t scrollUpper, scrollLower;
// Define the number of devices we have in the chain and the hardware interface // NOTE: These pin numbers may not work with your hardware and may need changing
// HARDWARE SPI MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
char msgL[] = { "Double height with custom font & 2 zones", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz", "0123456789", "`!@#$%^&()_+-={};:'<>\"?,./|\{}", }; char *msgH; // allocated memory in setup()
void setup(void) { uint8_t max = 0; P.setIntensity(0);
Serial.begin(115200); PRINTS("\n[Double_Height_v2]");
// set up global parameters invertUpperZone = (HARDWARE_TYPE == MD_MAX72XX::GENERIC_HW || HARDWARE_TYPE == MD_MAX72XX::PAROLA_HW); if (invertUpperZone) {
scrollUpper = PA_SCROLL_RIGHT;
scrollLower = PA_SCROLL_LEFT;
scrollUpper = PA_SCROLL_LEFT;
scrollLower = PA_SCROLL_RIGHT;
} else // not invert {
scrollUpper = PA_SCROLL_LEFT;
scrollLower = PA_SCROLL_LEFT;
scrollUpper = PA_SCROLL_RIGHT;
scrollLower = PA_SCROLL_RIGHT;
}
// work out the size of buffer required for (uint8_t i = 0; i<ARRAY_SIZE(msgL); i++) if (strlen(msgL[i]) > max) max = strlen(msgL[i]);
msgH = (char )malloc(sizeof(char)(max + 2));
// initialise the LED display P.begin(MAX_ZONES);
// Set up zones for 2 halves of the display P.setZone(ZONE_UPPER,0, ZONE_SIZE - 1 ); P.setZone(ZONE_LOWER,ZONE_SIZE,(ZONE_SIZE2)-1 ); P.setZone(ZONE_FREE, (ZONE_SIZE2), MAX_DEVICES);
// P.setZone(ZONE_UPPER,0,11 ); // P.setZone(ZONE_LOWER,12,24 ); // P.setZone(ZONE_FREE,25,36);
// P.setFont(BigFont); P.setCharSpacing(P.getCharSpacing() * 2); // double height --> double spacing if (invertUpperZone) { P.setZoneEffect(ZONE_UPPER, true, PA_FLIP_UD); P.setZoneEffect(ZONE_UPPER, true, PA_FLIP_LR); } PRINT("\nFLIP_UD=", P.getZoneEffect(ZONE_UPPER, PA_FLIP_UD)); PRINT("\nFLIP_LR=", P.getZoneEffect(ZONE_UPPER, PA_FLIP_LR)); PRINT("\nSCROLL_LEFT=", SCROLL_LEFT); }
void createHString(char pH, char pL) { for (; pL != '\0'; pL++) pH++ = *pL | 0x80; // offset character
*pH = '\0'; // terminate the string }
void loop(void) { static uint8_t cycle = 0;
P.displayAnimate();
if (P.getZoneStatus(ZONE_LOWER) && P.getZoneStatus(ZONE_UPPER) && P.getZoneStatus(ZONE_FREE)) { PRINT("\n", cycle); PRINT(": ", msgL[cycle]);
// set up the string
createHString(msgH, msgL[cycle]);
P.displayClear();
P.setFont(BigFont);
P.displayZoneText(ZONE_UPPER, msgH, PA_CENTER, SCROLL_SPEED, PAUSE_TIME, scrollUpper, scrollLower);
P.displayZoneText(ZONE_LOWER, msgL[cycle], PA_CENTER, SCROLL_SPEED, PAUSE_TIME, scrollUpper, scrollLower);
P.synchZoneStart();
test();
cycle = (cycle + 1) % ARRAY_SIZE(msgL);
// P.synchZoneStart();
} }
void test(){
P.setFont(font);
P.displayZoneText(ZONE_FREE,"......test........", PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
}`
fonts.h `const uint8_t dix8g3[] PROGMEM = { 4, 0x03, 0xFF, 0x81, 0xFF, 0x02, 0x02, 0xFF, 0x00, 0x03, 0xF9, 0x89, 0x8F, 0x03, 0x81, 0x89, 0xFF, 0x03, 0x1F, 0x10, 0xFC, 0x03, 0x8F, 0x89, 0xF9, 0x03, 0xFF, 0x89, 0xF9, 0x03, 0x01, 0xF1, 0x0F, 0x03, 0xFF, 0x89, 0xFF, 0x03, 0x9F, 0x91, 0xFF, };
const uint8_t dig6x8[] PROGMEM = { 7, 0x06, 0x7E, 0xFF, 0x81, 0x81, 0xFF, 0x7E,//1 0x06, 0x00, 0x82, 0xFF, 0xFF, 0x80, 0x00,//2 0x06, 0xC2, 0xE3, 0xB1, 0x99, 0x8F, 0x86,//3 0x06, 0x42, 0xC3, 0x89, 0x89, 0xFF, 0x76,//4 0x06, 0x38, 0x3C, 0x26, 0x23, 0xFF, 0xFF,//5 0x06, 0x4F, 0xCF, 0x89, 0x89, 0xF9, 0x71,//6 0x06, 0x7E, 0xFF, 0x89, 0x89, 0xFB, 0x72,//7 0x06, 0x01, 0x01, 0xF1, 0xF9, 0x0F, 0x07,//8 0x06, 0x76, 0xFF, 0x89, 0x89, 0xFF, 0x76,//9 0x06, 0x4E, 0xDF, 0x91, 0x91, 0xFF, 0x7E,//0 6, 0,0,0,0,0,0 };
const uint8_t dig4x8[] PROGMEM = { 5, 0x04, 0xFF, 0x81, 0x81, 0xFF, 0x04, 0x04, 0x02, 0xFF, 0x00, 0x04, 0xF9, 0x89, 0x89, 0x8F, 0x04, 0x81, 0x89, 0x89, 0xFF, 0x04, 0x1F, 0x10, 0x10, 0xFE, 0x04, 0x8F, 0x89, 0x89, 0xF9, 0x04, 0xFF, 0x89, 0x89, 0xF8, 0x04, 0x01, 0xC1, 0x31, 0x0F, 0x04, 0xFF, 0x89, 0x89, 0xFF, 0x04, 0x1F, 0x91, 0x91, 0xFF, };
const uint8_t dig3x7[] PROGMEM = { 4, 0x03, 0xFE, 0x82, 0xFE, 0x03, 0x08, 0x04, 0xFE, 0x03, 0xF2, 0x92, 0x9E, 0x03, 0x82, 0x92, 0xFE, 0x03, 0x3E, 0x20, 0xFC, 0x03, 0x9E, 0x92, 0xF2, 0x03, 0xFE, 0x92, 0xF2, 0x03, 0x02, 0xE2, 0x1E, 0x03, 0xFE, 0x92, 0xFE, 0x03, 0x9E, 0x92, 0xFE, };
const uint8_t dig3x6[] PROGMEM = { 4, 0x03, 0xFC, 0x84, 0xFC, 0x03, 0x10, 0x08, 0xFC, 0x03, 0xF4, 0x94, 0x9C, 0x03, 0x84, 0x94, 0xFC, 0x03, 0x3C, 0x20, 0xF8, 0x03, 0x9C, 0x94, 0xF4, 0x03, 0xFC, 0x94, 0xF4, 0x03, 0x04, 0xE4, 0x1C, 0x03, 0xFC, 0x94, 0xFC, 0x03, 0xBC, 0xA4, 0xFC, };
const uint8_t dig3x5[] PROGMEM = { 4, 0x03, 0xF8, 0x88, 0xF8, 0x02, 0x10, 0xF8, 0x00, 0x03, 0xE8, 0xA8, 0xB8, 0x03, 0x88, 0xA8, 0xF8, 0x03, 0x38, 0x20, 0xF8, 0x03, 0xB8, 0xA8, 0xE8, 0x03, 0xF8, 0xA8, 0xE8, 0x03, 0x08, 0x08, 0xF8, 0x03, 0xF8, 0xA8, 0xF8, 0x03, 0xB8, 0xA8, 0xF8, }; const uint8_t dig5x8rn[] PROGMEM = { 6, 0x05, 0x7E, 0x81, 0x81, 0xFF, 0x7E, 0x05, 0x04, 0x02, 0xFF, 0xFF, 0x00, 0x05, 0xF1, 0x89, 0x89, 0x8F, 0x86, 0x05, 0x81, 0x89, 0x89, 0xFF, 0x76, 0x05, 0x1F, 0x10, 0x10, 0xFE, 0xFE, 0x05, 0x8F, 0x89, 0x89, 0xF9, 0x71, 0x05, 0x7E, 0x89, 0x89, 0xF9, 0x70, 0x05, 0x01, 0xC1, 0xF1, 0x3F, 0x0F, 0x05, 0x76, 0x89, 0x89, 0xFF, 0x76, 0x05, 0x0E, 0x91, 0x91, 0xFF, 0x7E, };
const uint8_t dig5x8sq[] PROGMEM = { 6, 0x05, 0xFF, 0x81, 0x81, 0xFF, 0xFF, 0x04, 0x04, 0x02, 0xFF, 0xFF, 0x00, 0x05, 0xF9, 0x89, 0x89, 0x8F, 0x8F, 0x05, 0x81, 0x89, 0x89, 0xFF, 0xFF, 0x05, 0x1F, 0x10, 0x10, 0xFE, 0xFE, 0x05, 0x8F, 0x89, 0x89, 0xF9, 0xF9, 0x05, 0xFF, 0x89, 0x89, 0xF9, 0xF9, 0x05, 0x01, 0x01, 0x01, 0xFF, 0xFF, 0x05, 0xFF, 0x89, 0x89, 0xFF, 0xFF, 0x05, 0x9F, 0x91, 0x91, 0xFF, 0xFF, };
const uint8_t dweek_pl[] PROGMEM = { 11,
0x0A, 0xFC, 0x08, 0x10, 0xFC, 0x00, 0xFC, 0x00, 0xFC, 0x94, 0x84,
0x09, 0xFC, 0x24, 0x24, 0x3C, 0x00, 0xFC, 0x84, 0x84, 0xFC, 0x00,
0x09, 0xFC, 0x80, 0xF0, 0x80, 0xFC, 0x00, 0x04, 0xFC, 0x04, 0x00,
0x09, 0xDC, 0x94, 0x96, 0xF5, 0x00, 0xFC, 0x24, 0x64, 0xBC, 0x00,
0x09, 0xFC, 0x84, 0x84, 0xCC, 0x00, 0xC4, 0xA4, 0x94, 0x8C, 0x00,
0x0A, 0xFC, 0x24, 0x24, 0x3C, 0x00, 0xFC, 0x00, 0xFC, 0x24, 0xFC,
0x09, 0xDC, 0x94, 0x94, 0xF4, 0x00, 0xFC, 0x84, 0x84, 0xFC, 0x00,
0x09, 0x07, 0x05, 0x07, 0x00, 0xFF, 0xFF, 0x81, 0x81, 0x81, 0x00,
};
const uint8_t dweek_en[] PROGMEM = { 11, 0x09, 0x9C, 0x94, 0x94, 0xF4, 0x00, 0xFC, 0x80, 0x80, 0xFC, 0x00, 0x0A, 0xFC, 0x04, 0x3C, 0x04, 0xFC, 0x00, 0xFC, 0x84, 0x84, 0xFC, 0x0A, 0x04, 0x04, 0xFC, 0x04, 0x04, 0x00, 0xFC, 0x80, 0x80, 0xFC, 0x0A, 0xFC, 0x80, 0xF0, 0x80, 0xFC, 0x00, 0xFC, 0x94, 0x94, 0x84, 0x0A, 0x04, 0x04, 0xFC, 0x04, 0x04, 0x00, 0xFC, 0x10, 0x10, 0xFC, 0x09, 0xFC, 0x24, 0x24, 0x04, 0x00, 0xFC, 0x24, 0x64, 0xBC, 0x00, 0x09, 0x9C, 0x94, 0x94, 0xF4, 0x00, 0xFC, 0x24, 0x24, 0xFC, 0x00, 0x09, 0x07, 0x05, 0x07, 0x00, 0xFF, 0xFF, 0x81, 0x81, 0x81, 0x00, };
const uint8t font[] PROGMEM = {6, 2, B00000000, B00000000, B00000000, B00000000, B00000000, // space 1, B01011111, B00000000, B00000000, B00000000, B00000000, // ! 3, B00000011, B00000000, B00000011, B00000000, B00000000, // " 5, B00010100, B00111110, B00010100, B00111110, B00010100, // # 4, B00100100, B01101010, B00101011, B00010010, B00000000, // 0x 5, B01100011, B00010011, B00001000, B01100100, B01100011, // % 5, B00110110, B01001001, B01010110, B00100000, B01010000, // & 1, B00000011, B00000000, B00000000, B00000000, B00000000, // ' 3, B00011100, B00100010, B01000001, B00000000, B00000000, // ( 3, B01000001, B00100010, B00011100, B00000000, B00000000, // ) 5, B00101000, B00011000, B00001110, B00011000, B00101000, // * 5, B00001000, B00001000, B00111110, B00001000, B00001000, // + 2, B10110000, B01110000, B00000000, B00000000, B00000000, // , 4, B00001000, B00001000, B00001000, B00001000, B00000000, // - 1, B01000000, B00000000, B00000000, B00000000, B00000000, // . 3, B01100000, B00011100, B00000011, B00000000, B00000000, // / 4, B00111110, B01000001, B01000001, B00111110, B00000000, // 0 3, B01000010, B01111111, B01000000, B00000000, B00000000, // 1 4, B01100010, B01010001, B01001001, B01000110, B00000000, // 2 4, B00100010, B01000001, B01001001, B00110110, B00000000, // 3 4, B00011000, B00010100, B00010010, B01111111, B00000000, // 4 4, B00100111, B01000101, B01000101, B00111001, B00000000, // 5 4, B00111110, B01001001, B01001001, B00110010, B00000000, // 6 4, B01100001, B00010001, B00001001, B00000111, B00000000, // 7 4, B00110110, B01001001, B01001001, B00110110, B00000000, // 8 4, B00100110, B01001001, B01001001, B00111110, B00000000, // 9 1, B01000100, B00000000, B00000000, B00000000, B00000000, // : 2, B10000000, B01010000, B00000000, B00000000, B00000000, // ; 3, B00010000, B00101000, B01000100, B00000000, B00000000, // < 3, B00010100, B00010100, B00010100, B00000000, B00000000, // = 3, B01000100, B00101000, B00010000, B00000000, B00000000, // > 4, B00000010, B01011001, B00001001, B00000110, B00000000, // ? 5, B00111110, B01001001, B01010101, B01011101, B00001110, // @ 4, B01111110, B00010001, B00010001, B01111110, B00000000, // A 4, B01111111, B01001001, B01001001, B00110110, B00000000, // B 4, B00111110, B01000001, B01000001, B00100010, B00000000, // C 4, B01111111, B01000001, B01000001, B00111110, B00000000, // D 4, B01111111, B01001001, B01001001, B01000001, B00000000, // E 4, B01111111, B00001001, B00001001, B00000001, B00000000, // F 4, B00111110, B01000001, B01001001, B01111010, B00000000, // G 4, B01111111, B00001000, B00001000, B01111111, B00000000, // H 3, B01000001, B01111111, B01000001, B00000000, B00000000, // I 4, B00110000, B01000000, B01000001, B00111111, B00000000, // J 4, B01111111, B00001000, B00010100, B01100011, B00000000, // K 4, B01111111, B01000000, B01000000, B01000000, B00000000, // L 5, B01111111, B00000010, B00001100, B00000010, B01111111, // M 5, B01111111, B00000100, B00001000, B00010000, B01111111, // N 4, B00111110, B01000001, B01000001, B00111110, B00000000, // O 4, B01111111, B00001001, B00001001, B00000110, B00000000, // P 4, B00111110, B01000001, B01000001, B10111110, B00000000, // Q 4, B01111111, B00001001, B00001001, B01110110, B00000000, // R 4, B00100110, B01001001, B01001001, B00110010, B00000000, // S 5, B00000001, B00000001, B01111111, B00000001, B00000001, // T 4, B00111111, B01000000, B01000000, B00111111, B00000000, // U 5, B00001111, B00110000, B01000000, B00110000, B00001111, // V 5, B00111111, B01000000, B00111000, B01000000, B00111111, // W 5, B01100011, B00010100, B00001000, B00010100, B01100011, // X 5, B00000111, B00001000, B01110000, B00001000, B00000111, // Y 4, B01100001, B01010001, B01001001, B01000111, B00000000, // Z 2, B01111111, B01000001, B00000000, B00000000, B00000000, // [ 4, B00000001, B00000110, B00011000, B01100000, B00000000, // \ backslash 2, B01000001, B01111111, B00000000, B00000000, B00000000, // ] 3, B00000010, B00000001, B00000010, B00000000, B00000000, // hat 4, B01000000, B01000000, B01000000, B01000000, B00000000, // 2, B00000001, B00000010, B00000000, B00000000, B00000000, // ` 4, B00100000, B01010100, B01010100, B01111000, B00000000, // a 4, B01111111, B01000100, B01000100, B00111000, B00000000, // b 4, B00111000, B01000100, B01000100, B00101000, B00000000, // c 4, B00111000, B01000100, B01000100, B01111111, B00000000, // d 4, B00111000, B01010100, B01010100, B00011000, B00000000, // e 3, B00000100, B01111110, B00000101, B00000000, B00000000, // f 4, B10011000, B10100100, B10100100, B01111000, B00000000, // g 4, B01111111, B00000100, B00000100, B01111000, B00000000, // h 3, B01000100, B01111101, B01000000, B00000000, B00000000, // i 4, B01000000, B10000000, B10000100, B01111101, B00000000, // j 4, B01111111, B00010000, B00101000, B01000100, B00000000, // k 3, B01000001, B01111111, B01000000, B00000000, B00000000, // l 5, B01111100, B00000100, B01111100, B00000100, B01111000, // m 4, B01111100, B00000100, B00000100, B01111000, B00000000, // n 4, B00111000, B01000100, B01000100, B00111000, B00000000, // o 4, B11111100, B00100100, B00100100, B00011000, B00000000, // p 4, B00011000, B00100100, B00100100, B11111100, B00000000, // q 4, B01111100, B00001000, B00000100, B00000100, B00000000, // r 4, B01001000, B01010100, B01010100, B00100100, B00000000, // s 3, B00000100, B00111111, B01000100, B00000000, B00000000, // t 4, B00111100, B01000000, B01000000, B01111100, B00000000, // u 5, B00011100, B00100000, B01000000, B00100000, B00011100, // v 5, B00111100, B01000000, B00111100, B01000000, B00111100, // w 5, B01000100, B00101000, B00010000, B00101000, B01000100, // x 4, B10011100, B10100000, B10100000, B01111100, B00000000, // y 3, B01100100, B01010100, B01001100, B00000000, B00000000, // z 3, B00001000, B00110110, B01000001, B00000000, B00000000, // { 1, B01111111, B00000000, B00000000, B00000000, B00000000, // | 3, B01000001, B00110110, B00001000, B00000000, B00000000, // } 4, B00001000, B00000100, B00001000, B00000100, B00000000, // ~
5, B00100000, B01010100, B01010100, B11111000, B10000000, // a 4, B00111000, B01000100, B01000110, B00101001, B00000000, // c 4, B00111000, B01010100, B11010100, B10011000, B00000000, // e 3, B01010001, B01111111, B01000100, B00000000, B00000000, // l 4, B01111100, B00000100, B00000110, B01111001, B00000000, // n 4, B00111000, B01000100, B01000110, B00111001, B00000000, // o 4, B01001000, B01010100, B01010110, B00100101, B00000000, // s 3, B01100100, B01010110, B01001101, B00000000, B00000000, // z 3, B01100100, B01010101, B01001100, B00000000, B00000000, // z 5, B01111110, B00010001, B00010001, B11111110, B10000000, // A 4, B00111100, B01000010, B01000011, B00100101, B00000000, // C 5, B01111111, B01001001, B01001001, B11000001, B10000000, // E 4, B01111111, B01001000, B01000100, B01000000, B00000000, // L 5, B01111110, B00000100, B00001010, B00010001, B01111110, // N 4, B00111100, B01000110, B01000011, B00111100, B00000000, // O 4, B00100100, B01001010, B01001011, B00110000, B00000000, // S 4, B01100010, B01010110, B01001011, B01000110, B00000000, // Z 4, B01101001, B01011001, B01001101, B01001011, B00000000, // Z
5, B00111110, B01010101, B01100001, B01010101, B00111110, // :) 5, B00111110, B01100101, B01010001, B01100101, B00111110, // :( 5, B00111110, B01000101, B01010001, B01000101, B00111110, // :o 5, 0x06, 0x1F, 0x7E, 0x1F, 0x06, // heart 5, 0x04, 0x02, 0x7F, 0x02, 0x04, // arrow up 5, 0x10, 0x20, 0x7F, 0x20, 0x10, // arrow down 3, B00000010, B00000101, B00000010, B00000000, B00000000, // deg };
//const uint8_t 16_24[] PROGMEM = { // 0x0E, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x03, 0xE0, 0xFF, 0x0F, 0xF8, 0xFF, 0x3F, 0x78, 0x00, 0x3C, 0x3C, 0x00, 0x78, 0x1C, 0x00, 0x70, 0x1C, 0x00, 0x70, 0x1C, 0x00, 0x70, 0x3C, 0x00, 0x78, 0x78, 0x00, 0x3C, 0xF8, 0xFF, 0x3F, 0xE0, 0xFF, 0x0F, 0x80, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 0 // 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x70, 0xE0, 0x00, 0x70, 0xE0, 0x00, 0x70, 0xF0, 0x00, 0x70, 0xF8, 0xFF, 0x7F, 0xFC, 0xFF, 0x7F, 0xFC, 0xFF, 0x7F, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 1 // 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x78, 0x38, 0x00, 0x7C, 0x1C, 0x00, 0x7E, 0x1C, 0x00, 0x77, 0x1C, 0x80, 0x73, 0x1C, 0xC0, 0x71, 0x1C, 0xE0, 0x70, 0x1C, 0x70, 0x70, 0x3C, 0x3C, 0x70, 0xF8, 0x1F, 0x70, 0xF0, 0x0F, 0x70, 0xE0, 0x03, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, // Code for char 2 // 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x00, 0x38, 0x38, 0x00, 0x70, 0x1C, 0x00, 0x70, 0x1C, 0x38, 0x70, 0x1C, 0x38, 0x70, 0x1C, 0x38, 0x70, 0x1C, 0x38, 0x70, 0x1C, 0x3C, 0x78, 0x3C, 0x76, 0x3C, 0xF8, 0xF7, 0x3F, 0xF8, 0xE3, 0x1F, 0xE0, 0xC1, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 3 // 0x0F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0xF8, 0x00, 0x00, 0xEE, 0x00, 0x00, 0xE7, 0x00, 0x80, 0xE3, 0x00, 0xC0, 0xE1, 0x00, 0xE0, 0xE0, 0x00, 0x70, 0xE0, 0x00, 0x18, 0xE0, 0x00, 0xFC, 0xFF, 0x7F, 0xFC, 0xFF, 0x7F, 0xFC, 0xFF, 0x7F, 0x00, 0xE0, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, // Code for char 4 // 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0xFC, 0x3F, 0x38, 0xFC, 0x1F, 0x70, 0xFC, 0x1F, 0x70, 0x1C, 0x1C, 0x70, 0x1C, 0x1C, 0x70, 0x1C, 0x1C, 0x70, 0x1C, 0x1C, 0x70, 0x1C, 0x3C, 0x78, 0x1C, 0x38, 0x3C, 0x1C, 0xF8, 0x3F, 0x1C, 0xF0, 0x1F, 0x1C, 0xE0, 0x07, 0x00, 0x00, 0x00, // Code for char 5 // 0x0F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x03, 0x80, 0xFF, 0x0F, 0xE0, 0xFF, 0x1F, 0xF0, 0x39, 0x3C, 0x78, 0x18, 0x78, 0x38, 0x1C, 0x70, 0x3C, 0x1C, 0x70, 0x1C, 0x1C, 0x70, 0x1C, 0x1C, 0x70, 0x1C, 0x3C, 0x78, 0x1C, 0x38, 0x3C, 0x3C, 0xF8, 0x3F, 0x00, 0xF0, 0x1F, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00, // Code for char 6 // 0x0E, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x1C, 0x00, 0x40, 0x1C, 0x00, 0x70, 0x1C, 0x00, 0x7C, 0x1C, 0x00, 0x3F, 0x1C, 0xC0, 0x0F, 0x1C, 0xF0, 0x03, 0x1C, 0xFC, 0x00, 0x1C, 0x3E, 0x00, 0x9C, 0x0F, 0x00, 0xFC, 0x03, 0x00, 0xFC, 0x01, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 7 // 0x0F, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0xE0, 0xE1, 0x1F, 0xF0, 0xE7, 0x3F, 0xF8, 0x37, 0x3C, 0x3C, 0x1E, 0x78, 0x1C, 0x1C, 0x70, 0x1C, 0x1C, 0x70, 0x1C, 0x18, 0x70, 0x1C, 0x38, 0x70, 0x3C, 0x3C, 0x78, 0xF8, 0x7F, 0x38, 0xF0, 0xE7, 0x3F, 0xE0, 0xE1, 0x1F, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, // Code for char 8 // 0x0F, 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0xF0, 0x1F, 0x00, 0xF8, 0x3F, 0x78, 0x78, 0x38, 0x70, 0x3C, 0x78, 0x70, 0x1C, 0x70, 0x70, 0x1C, 0x70, 0x70, 0x1C, 0x70, 0x78, 0x1C, 0x70, 0x38, 0x3C, 0x30, 0x3C, 0x78, 0x38, 0x1F, 0xF0, 0xFF, 0x0F, 0xE0, 0xFF, 0x03, 0x80, 0xFF, 0x00, 0x00, 0x00, 0x00, // Code for char 9 // 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x0F, 0xF0, 0x00, 0x0F, 0xF0, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char : // 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x07, 0xF8, 0x80, 0x07, 0xF8, 0x80, 0x07, 0x38, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ; ); // }; `
Please see my previous comment. You need to tell me what is not working. I do not have 36 modules nor do I have the time to set this up and try your software. If you tell me what you see and what is not working I may be able to tell from the code. Otherwise this will never be resolved.
(P.getZoneStatus(ZONE_LOWER) && P.getZoneStatus(ZONE_UPPER) && P.getZoneStatus(ZONE_FREE)
This will NOT work as the LOWER and UPPER follow the same time for animation while FREE must be on different timing as it is a different size. You need to check for FREE separately.
Ok i see. And how to change font? For 16x8 you used BigFonts. I try to make some video how it works now and what not
Every zone has its own font. You set it the same way you set the font in the other zones. If you don't set the font (or set it to nullptr) you get the standard font. When you don't specify the number of zones you are actually running a one zone display.
ok code: `// Demonstrates one double height display using Parola using a single font file // defintion created with the MD_MAX72xx font builder. // // Each font file has the lower part of a character as ASCII codes 0-127 and the // upper part of the character in ASCII code 128-255. Adding 128 to each lower // character creates the correct index for the upper character. // The upper and lower portions are managed as 2 zones 'stacked' on top of each other // so that the module numbers are in the sequence shown below: // // Modules (like FC-16) that can fit over each other with no gap // n n-1 n-2 ... n/2+1 <- this direction top row // n/2 ... 3 2 1 0 <- this direction bottom row // // Modules (like Generic and Parola) that cannot fit over each other with no gap // n/2+1 ... n-2 n-1 n -> this direction top row // n/2 ... 3 2 1 0 <- this direction bottom row // // Sending the original string to the lower zone and the modified (+128) string to the // upper zone creates the complete message on the display. // // MD_MAX72XX library can be found at https://github.com/MajicDesigns/MD_MAX72XX //
// Turn debugging on and off
// Define the main direction for scrolling double height. // if 1, scroll left; if 0, scroll right
// Hardware adaptation parameters for scrolling bool invertUpperZone = false; textEffect_t scrollUpper, scrollLower;
// Define the number of devices we have in the chain and the hardware interface // NOTE: These pin numbers may not work with your hardware and may need changing
// HARDWARE SPI MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
char msgL[] = { "Double height", "TEST", "test", "01234", "`!@#$", }; char msgH; // allocated memory in setup()
void setup(void) { uint8_t max = 0; P.setIntensity(0);
// set up global parameters invertUpperZone = (HARDWARE_TYPE == MD_MAX72XX::GENERIC_HW || HARDWARE_TYPE == MD_MAX72XX::PAROLA_HW); if (invertUpperZone) {
scrollUpper = PA_SCROLL_RIGHT;
scrollLower = PA_SCROLL_LEFT;
scrollUpper = PA_SCROLL_LEFT;
scrollLower = PA_SCROLL_RIGHT;
} else // not invert {
scrollUpper = PA_SCROLL_LEFT;
scrollLower = PA_SCROLL_LEFT;
scrollUpper = PA_SCROLL_RIGHT;
scrollLower = PA_SCROLL_RIGHT;
}
// work out the size of buffer required for (uint8_t i = 0; i<ARRAY_SIZE(msgL); i++) if (strlen(msgL[i]) > max) max = strlen(msgL[i]);
msgH = (char )malloc(sizeof(char)(max + 2));
// initialise the LED display P.begin(MAX_ZONES);
// Set up zones for 2 halves of the display P.setZone(ZONE_UPPER,0, ZONE_SIZE - 1 ); // P.setZone(ZONE_UPPER,0,11 ); P.setZone(ZONE_LOWER,ZONE_SIZE,(ZONE_SIZE2)-1 ); // P.setZone(ZONE_LOWER,12,24 ); P.setZone(ZONE_FREE, ZONE_SIZE2, (ZONE_SIZE*3)-1); // P.setZone(ZONE_FREE,24,35);
// P.setFont(BigFont); P.setCharSpacing(P.getCharSpacing() * 2); // double height --> double spacing if (invertUpperZone) { P.setZoneEffect(ZONE_UPPER, true, PA_FLIP_UD); P.setZoneEffect(ZONE_UPPER, true, PA_FLIP_LR); } }
void createHString(char pH, char pL) { for (; pL != '\0'; pL++) pH++ = *pL | 0x80; // offset character
*pH = '\0'; // terminate the string }
void loop(void){ static uint8_t cycle = 0;
P.displayAnimate();
if (P.getZoneStatus(ZONE_LOWER) && P.getZoneStatus(ZONE_UPPER)) { // PRINT("\n", cycle); // PRINT(": ", msgL[cycle]); createHString(msgH, msgL[cycle]);
// P.displayClear(); P.setFont(BigFont); P.displayZoneText(ZONE_UPPER, msgH, PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_LEFT, PA_SCROLL_LEFT); P.displayZoneText(ZONE_LOWER, msgL[cycle], PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_LEFT, PA_SCROLL_LEFT); P.synchZoneStart(); cycle = (cycle + 1) % ARRAY_SIZE(msgL); }
if (P.getZoneStatus(ZONE_FREE)){
// P.displayClear(); // P.setFont(font); P.displayZoneText(ZONE_FREE, "test", PA_LEFT, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_LEFT, PA_SCROLL_RIGHT); }
} `
works, but in zone 2 fonts are the same as upper.. https://www.youtube.com/watch?v=_QlbG0nVwJc
P.setFont(BigFont);
Sets the font for ALL zones.
Use setZoneFont() to set the font for one zone. And you only need to set the font once in setup() if you don't need to change it during running.
'class MD_Parola' has no member named 'SetZoneFont' When using: void setZoneFont(MD_MAX72XX::fontType_t *fontDef) { _fontDef = fontDef; _MX->setFont(_fontDef); allocateFontBuffer(); } from MD_Parola.h setZoneFont(font5x7); 'setZoneFont' was not declared in this scope MD_Parola.cpp has not setZoneFont... hmm...
My mistake. setZoneFont is an internal function. The external function is setFont but you specify the zone you want.
All this is in the library documentation. You may save time if you read that.
ok, so in this case: `void loop(void){ static uint8_t cycle = 0;
P.displayAnimate();
if (P.getZoneStatus(ZONE_LOWER) && P.getZoneStatus(ZONE_UPPER)) { createHString(msgH, msgL[cycle]); // P.displayClear(); P.setFont(0,BigFont); P.setFont(1,BigFont); P.displayZoneText(ZONE_UPPER, msgH, PA_RIGHT, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_LEFT, PA_SCROLL_DOWN_RIGHT); P.displayZoneText(ZONE_LOWER, msgL[cycle], PA_RIGHT, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_LEFT, PA_SCROLL_UP_RIGHT); P.synchZoneStart(); cycle = (cycle + 1) % ARRAY_SIZE(msgL); }
if (P.getZoneStatus(ZONE_FREE)){
// P.displayClear(); P.setFont(2,font5x7); P.displayZoneText(ZONE_FREE, "test", PA_LEFT, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_LEFT, PA_SCROLL_RIGHT); } }`
P.setFont(2,font5x7);, yes?
I would set the font in the setup() otherwise you are setting it up many many many more times than required. You only need to tell the library once if you don't plan to change it.
The location of the zone 2 setFont will mean it is executed many hundreds of times a second - no need, especially as there is some overhead in to setting the font.
Yes,offcourse, i take it to setup, this only for test. Sure to call once when nothing change on zone..
I saw some strange behaviour. From time to time, one or more of displays (random) stop working good or stay black.. After reset works ok. Strange, this is no hardware isue, but i was check the scope of this signals and zonk.. Clock in the all out pins module looks like saw, no like rectangle..from esp looks ok. Data looks similar.. Transmision error? China fake max chips?
Look at video.
The problem may just be the number of devices in the chain, bad connections, power supply, signal attenuation, etc, but you have not provided any information on this. All the signals can be provided in parallel (see picture at https://arduinoplusplus.wordpress.com/2018/07/13/fun-and-games-and-a-new-library/#jp-carousel-9424) to the modules except for DataOut to DataIn, which should never have a bad signal anyway. If you do them all serially there are issues with attenuation and dropouts unless you take precautions. Lots of that on the internet, just search for it.
As your software issues are resolved I will close this issue.
tnx:)
could i ask for one more?
i try to write function with string, to display text without table:
char *msgL[] = { "Double height", "TEST LARGE", "test small", "01234 43210", "!@#$ %$#@!", };
`void bigFont(String message){ if (P.getZoneStatus(ZONE_LOWER) && P.getZoneStatus(ZONE_UPPER)) { int str_len = message.length() + 1; //length of string char char_array[str_len]; //buffer of length of string message.toCharArray(char_array, str_len); //copy to buffer
createHString(msgH, char_array); //create big font H is working...
P.setFont(0,BigFont);
P.setFont(1,BigFont);
P.displayZoneText(ZONE_UPPER, msgH, PA_RIGHT, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_LEFT, PA_CLOSING);
P.displayZoneText(ZONE_LOWER, char_array, PA_RIGHT, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_LEFT, PA_CLOSING);
P.synchZoneStart();
P.synchZoneStart();
`
i see only upper display..
I don't use Strings so hard to give any advice (other than learn not to use them on microcontrollers). I suspect that the definitions for the size of the strings may be wrong. Try printing out the text and make sure it is what you expect it to be.
A better place for these more general C/C++ questions is the Arduino Forum.
ok i got... bigFont("test funkcji");
when i write this way: `void bigFont(String message){ if (P.getZoneStatus(ZONE_LOWER) && P.getZoneStatus(ZONE_UPPER)) { int str_len = message.length() + 1; //length of string char char_array[str_len]; //buffer of length of string message.toCharArray(char_array, str_len); //copy to buffer
createHString(msgH, char_array); //create big font
P.setFont(0,BigFont);
P.setFont(1,BigFont);
P.displayZoneText(ZONE_UPPER, msgH, PA_RIGHT, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_LEFT, PA_CLOSING);
P.displayZoneText(ZONE_LOWER, "test funkcji", PA_RIGHT, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_LEFT, PA_CLOSING);
P.synchZoneStart();
} }`
it is work, so only transfer this string to P.displayZoneText not work correct..
ok, this way works ok:
`#define MAX_MESG 20 char Mesg[MAX_MESG+1] = "";
bigFont("123456789");
void bigFont(String message){
int str_len = message.length()+1; //length of string
Serial.println(str_len);
char char_array[str_len]; //buffer of length of string
message.toCharArray(char_array, str_len); //copy to buffer
strcpy(Mesg, char_array);
createHString(msgH, char_array); //create big font
P.setFont(0,BigFont);
P.setFont(1,BigFont);
P.displayZoneText(ZONE_UPPER, msgH, PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_LEFT, PA_CLOSING);
P.displayZoneText(ZONE_LOWER, Mesg, PA_RIGHT, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_LEFT, PA_CLOSING);
P.synchZoneStart();
}`
one more.. Why when text is smaller than zone working ok, but when is biggest, working strange? https://www.youtube.com/watch?v=gJ3-wIHECIA https://www.youtube.com/watch?v=E91-GtjxiKA
code:
`#include
// Define the main direction for scrolling double height. // if 1, scroll left; if 0, scroll right
// Hardware adaptation parameters for scrolling bool invertUpperZone = false; textEffect_t scrollUpper, scrollLower;
// Define the number of devices we have in the chain and the hardware interface // NOTE: These pin numbers may not work with your hardware and may need changing
// HARDWARE SPI MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
char MesgLARGE[MAX_MESG+1] = ""; char MesgSMALL[MAX_MESG+1] = ""; char *msgH; uint8_t str_len; //buffer size
void setup(void) { Serial.begin(115200); delay(10); uint8_t max = 0; P.setIntensity(0); msgH = (char )malloc(sizeof(char)(max + 2));
// initialise the LED display P.begin(MAX_ZONES);
// Set up zones for 2 halves of the display P.setZone(ZONE_UPPER,0, ZONE_SIZE - 1 ); // P.setZone(ZONE_UPPER,0,11 ); P.setZone(ZONE_LOWER,ZONE_SIZE,(ZONE_SIZE2)-1 ); // P.setZone(ZONE_LOWER,12,24 ); P.setZone(ZONE_FREE, ZONE_SIZE2, (ZONE_SIZE3)-1); // P.setZone(ZONE_FREE,24,35); // P.displayZoneText(ZONE_UPPER, msgH, PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_RIGHT, PA_SCROLL_LEFT); // P.displayZoneText(ZONE_LOWER, MesgLARGE, PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_RIGHT, PA_SCROLL_LEFT); // P.displayZoneText(ZONE_FREE, MesgSMALL, PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_LEFT, PA_SCROLL_LEFT); P.setCharSpacing(P.getCharSpacing() 2); // double height --> double spacing
if (invertUpperZone) { P.setZoneEffect(ZONE_UPPER, true, PA_FLIP_UD); P.setZoneEffect(ZONE_UPPER, true, PA_FLIP_LR); } P.displayClear(); }
void createHString(char pH, char pL) { for (; pL != '\0'; pL++) pH++ = *pL | 0x80; // offset character
*pH = '\0'; // terminate the string }
uint8_t i,y; void loop(void){ P.displayAnimate(); if (P.getZoneStatus(ZONE_FREE)){ switch(i){ case 0: smallFont("jeden test "); break;
case 1:
smallFont("dwa test ");
break;
case 2:
smallFont("trzy test ");
break;
}
i++;
P.displayReset(ZONE_FREE);
if (i>2){
i=0;
}
}
if (P.getZoneStatus(ZONE_LOWER) && P.getZoneStatus(ZONE_UPPER)){
P.setFont(ZONE_UPPER,BigFont);
P.setFont(ZONE_LOWER,BigFont);
switch(y){
case 0:
bigFont("12345678910");
P.synchZoneStart();
break;
case 1:
bigFont("abcdefghijk");
P.synchZoneStart();
break;
case 2:
bigFont("1a2b3c4e5f6g");
P.synchZoneStart();
break;
}
P.synchZoneStart();
y++;
if(y>2){y=0;}
}
}
void bigFont(String message){
str_len = message.length()+1; //length of string
Serial.println(str_len);
char char_array_large[str_len]; //buffer of length of string
message.toCharArray(char_array_large, str_len); //copy to buffer
strcpy(MesgLARGE, char_array_large);
createHString(msgH, char_array_large); //create big font
P.displayZoneText(ZONE_UPPER, msgH, PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_RIGHT, PA_SCROLL_RIGHT);
P.displayZoneText(ZONE_LOWER, MesgLARGE, PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_RIGHT, PA_SCROLL_RIGHT);
}
void smallFont(String message){
int str_len = message.length()+1; //length of string
// Serial.println(str_len);
char char_array_small[str_len]; //buffer of length of string
message.toCharArray(char_array_small, str_len); //copy to buffer
strcpy(MesgSMALL, char_array_small);
P.displayZoneText(ZONE_FREE, MesgSMALL, PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
}`
Your method of creating the high part of the string is flawed. The statements
uint8_t max = 0; msgH = (char )malloc(sizeof(char)??(max + 2));
allocate a zero sized buffer. They used to allocate a buffer larger than the size of the biggest string. You are then overflowing the buffer. The fact this works sometimes and not others is a matter of luck.
I also really don't get why you need to use Strings to just get the length of a character array in the bigFont() and smallFont(), when you can use the strlen() function to get the length of the character array directly.
This issue has now drifted into a general personal programming support line and I would like you to shift to the Arduino forum if you need that sort of help. There is a Parola thread in the Exhibition/Gallery section that you can use or raise an issue in the Programming section.
hi esp 8622, md_parola 3.0.2 i have 12 display line and 3 columns, 36 matrix display. can i use 2 for big font (from exampe) and one normal? i try to display some text in 2'th zone, but something wrong..
0 zone and 1 zone is fordouble height, 2 for normal.
define MAX_DEVICES 36
define MAX_ZONES 3
define MAX_DEVICES (MAX_ZONES * ZONE_SIZE)
define ZONE_SIZE 12
define ZONE_UPPER 0
define ZONE_LOWER 1
define ZONE_FREE 2
P.setZone(ZONE_UPPER,0, ZONE_SIZE - 1 ); P.setZone(ZONE_LOWER,ZONE_SIZE,(ZONE_SIZE2)-1 ); P.setZone(ZONE_FREE, (ZONE_SIZE2), MAX_DEVICES);
in loop :: P.displayClear(); P.displayZoneText(ZONE_UPPER, msgH, PA_CENTER, SCROLL_SPEED, PAUSE_TIME, scrollUpper, scrollLower); P.displayZoneText(ZONE_LOWER, msgL[cycle], PA_CENTER, SCROLL_SPEED, PAUSE_TIME, scrollUpper, scrollLower); P.displayZoneText(ZONE_FREE,"test", PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_LEFT, PA_SCROLL_LEFT); cycle = (cycle + 1) % ARRAY_SIZE(msgL); P.synchZoneStart();
}
and "test" take big font..can i use normal font for this? I do not see any example for use gig font and small at the same time.
add new fonts? P.displayClear(); P.setFont(BigFont); P.displayZoneText(ZONE_UPPER, msgH, PA_CENTER, SCROLL_SPEED, PAUSE_TIME, scrollUpper, scrollLower); P.displayZoneText(ZONE_LOWER, msgL[cycle], PA_CENTER, SCROLL_SPEED, PAUSE_TIME, scrollUpper, scrollLower); P.setFont(font); P.displayZoneText(ZONE_FREE,"test", PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_SCROLL_LEFT, PA_SCROLL_LEFT); cycle = (cycle + 1) % ARRAY_SIZE(msgL); P.synchZoneStart();