Coding
Coding
Coding
dmd_latin_chars
Demo and example Latin-1 encoding project for the Freetronics DMD, a 512 LED matrix display
This example code is in the public domain. It demonstrates using the ISO-8859-1
Latin-1 support.
*******************************
*******************************
typing them. Arduino Sketches are saved in Unicode UTF-8 format, but the DMD library
To enter the characters as Latin-1, look at the codepage layout here and look for
https://en.wikipedia.org/wiki/ISO/IEC_8859-1#Codepage_layout
For example, á (lowercase a, rising diacritical mark) has hex value 00E0 in Latin-1.
To translate this into a constant string, replace the leading 00 with \x - so the
To be safe, the string may also need to be separated in its own quote marks - ie
"The Portugese for rapid is r""\xE0""pido"
When you compile the sketch, the compiler will join all these strings up into one
long string - however without the quotes around the \x it may try to include additional
/*--------------------------------------------------------------------------------------
Includes
--------------------------------------------------------------------------------------*/
#include <SPI.h> //SPI.h must be included as DMD is written by SPI (the IDE complains otherwise)
#include <DMD.h> //
#include <TimerOne.h> //
#include <SystemFont5x7.h>
#include <Arial_Black_16_ISO_8859_1.h>
#define DISPLAYS_ACROSS 3
#define DISPLAYS_DOWN 1
/*--------------------------------------------------------------------------------------
Interrupt handler for Timer1 (TimerOne) driven DMD refresh scanning, this gets
--------------------------------------------------------------------------------------*/
void ScanDMD()
dmd.scanDisplayBySPI();
}
/*--------------------------------------------------------------------------------------
setup
--------------------------------------------------------------------------------------*/
void setup(void)
//initialize TimerOne's interrupt/CPU usage used to scan and refresh the display
Timer1.initialize( 5000 ); //period in microseconds to call ScanDMD. Anything longer than 5000
(5ms) and you can see flicker.
dmd.clearScreen( true ); //true is normal (all pixels off), false is negative (all pixels on)
Serial.begin(115200);
/*--------------------------------------------------------------------------------------
loop
--------------------------------------------------------------------------------------*/
void loop(void)
dmd.clearScreen( true );
dmd.selectFont(Arial_Black_16_ISO_8859_1);
dmd.drawMarquee(MSG,strlen(MSG),(32*DISPLAYS_ACROSS)-1,0);
long start=millis();
long timer=start;
while(1){
dmd.stepMarquee(-1,0);
timer=millis();