/*
Arduino Sample Code for the Noritake Itron CU20025SCPB-T20A
Jos van Dijken - 20-FEB-2014
www.josvandijken.nl
*/
int led = 13;
void setup()
{
pinMode(led, OUTPUT);
Serial.begin(19200);
}
void loop()
{
ResetDisplay();
CursorOff();
ClearDisplay();
Intro();
delay(1000);
DemoCursor();
delay(1000);
DemoLuminance();
delay(1000);
ShowIntFont();
delay(1000);
ShowKatFont();
delay(1000);
}
void ClearDisplay()
{
Serial.write(0x0E); delay(10);
}
void PrintText(char* line1, char* line2)
{
Serial.write(0x0E);delay(10);
Serial.write(0x0C);delay(10);
Serial.print(line1);delay(10);
Serial.write(0x1B);delay(10);
Serial.write(0x48);delay(10);
Serial.write(0x14);delay(10);
Serial.print(line2);delay(10);
}
void DemoLuminance()
{
Serial.write(0x0E); delay(10);
Serial.write(0x0C); delay(10);
Serial.print("Programmable");
Serial.write(0x0A); delay(10);
Serial.write(0x0D); delay(10);
Serial.print("Luminance.");
Serial.write(0x0D); delay(10);
Serial.write(0x1B); delay(10); Serial.write(0x4C); delay(10); Serial.write(0x00); delay(10);
Serial.print("Luminance: 25 %."); delay(1000);
Serial.write(0x0D); delay(10);
Serial.write(0x1B); delay(10); Serial.write(0x4C); delay(10); Serial.write(0x40); delay(10);
Serial.print("Luminance: 50 %."); delay(1000);
Serial.write(0x0D); delay(10);
Serial.write(0x1B); delay(10); Serial.write(0x4C); delay(10); Serial.write(0x80); delay(10);
Serial.print("Luminance: 75 %."); delay(1000);
Serial.write(0x0D); delay(10);
Serial.write(0x1B); delay(10); Serial.write(0x4C); delay(10); Serial.write(0xC0); delay(10);
Serial.print("Luminance: 100 %."); delay(1000);
}
void ResetDisplay()
{
Serial.write(0x1B); delay(10);
Serial.write(0x49); delay(10);
}
void CursorOff()
{
Serial.write(0x16); delay(10);
}
void CursorUL()
{
Serial.write(0x14); delay(10);
}
void CursorBL()
{
Serial.write(0x15); delay(10);
}
void Intro()
{
Serial.write(0x0E); delay(10);
Serial.write(0x0C); delay(10);
Serial.print(" Noritake Itron "); delay(10);
Serial.print(" CU20025SCPB-T20A "); delay(10);
delay(1000);
Serial.print(" Arduino Demo ");
Serial.print(" Programm ");
}
void ShowIntFont()
{
Serial.write(0x0E); delay(10);
Serial.write(0x0C); delay(10);
Serial.print("International Font: ");
int j=0;
for(int i=33; i<256; i++)
{
Serial.write(i);
j++;
if(j==20)
{
delay(100);
Serial.write(0x1B);
Serial.write(0x48);
Serial.write(0x14);
j=0;
}
}
}
void ShowKatFont()
{
Serial.write(0x0E); delay(10);
Serial.write(0x0C); delay(10);
Seial.print("Kakatana Font: ");
Serial.write(0x19);
int j=0;
for(int i=128; i<256; i++)
{
Serial.write(i);
j++;
if(j==20)
{
delay(100);
Serial.write(0x1B);
Serial.write(0x48);
Serial.write(0x14);
j=0;
}
}
}
void DemoCursor()
{
Serial.write(0x0E); delay(10);
Serial.write(0x0C); delay(10);
Serial.print("Programmable Cursor:");
Serial.write(0x0D); delay(10);
Serial.print(" ");
Serial.write(0x0D); delay(10);
Serial.write(0x14); delay(10);
Serial.print("U"); delay(200);
Serial.print("n"); delay(200);
Serial.print("d"); delay(200);
Serial.print("e"); delay(200);
Serial.print("r"); delay(200);
Serial.print("l"); delay(200);
Serial.print("i"); delay(200);
Serial.print("n"); delay(200);
Serial.print("e"); delay(200);
Serial.print("."); delay(200);
delay(1000);
Serial.write(0x0D); delay(10);
Serial.print(" ");
Serial.write(0x0D); delay(10);
Serial.write(0x15);delay(10);
Serial.print("5"); delay(200);
Serial.print("x"); delay(200);
Serial.print("7"); delay(200);
Serial.print(" "); delay(200);
Serial.print("B"); delay(200);
Serial.print("l"); delay(200);
Serial.print("o"); delay(200);
Serial.print("c"); delay(200);
Serial.print("k"); delay(200);
Serial.print("."); delay(200);
delay(1000);
Serial.write(0x0D); delay(10);
Serial.print(" ");
Serial.write(0x0D); delay(10);
Serial.write(0x16);delay(10);
Serial.print("O"); delay(100);
Serial.print("f"); delay(100);
Serial.print("f"); delay(100);
Serial.print("."); delay(100);
}