Afisare iconite pe display-ul LCD 1604

Un display LCD 1604, 1602, 2004 etc poate afisa caractere alfanumerice deoarece pentru afisare foloseste o matrice de 8*5 puncte. In aceasta matrice noi putem afisa ce informatie dorim (in limita ceor 40 de puncte disponibile in matrice pentru fiecare pozitie disponibila) si, astfel, putem tipari diferite simboluri pe ecran.

Pentru a ne crea propriile simbolri putem folosi un editor grafic, acesta se gaseste aici si se numeste LCD Custom Character Generator.

Pentru a adauga aceste caractere la un sketch va trebui sa folosim urmatorul cod:  

byte lacatDeschis[] = {
  B01110,
  B10001,
  B10000,
  B10000,
  B11111,
  B11011,
  B11011,
  B11111
};  /creeam un array cu caracterul dorit

void setup() {
  lcd.createChar(0, lacatInchis);  //creem caracterul pentru a fi afisat pe display
}

void loop() {
  lcd.write(byte(0)); //afisam caracterul pe display
}

 

 Pentru afisarea pe un display LCD vom folosi informatiile din acest articol pentru a conecta afisajul la Arduino.

In sketch vom afisa grupuri de cate 8 iconite. Sketch-ul arata asa: 

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

byte lacatInchis[] = {
  B01110,  B10001,  B10001,  B10001,  B11111,  B11011,  B11011,  B11111
};
byte lacatDeschis[] = {
  B01110,  B10001,  B10000,  B10000,  B11111,  B11011,  B11011,  B11111
};
byte sageataSus[] = {
  B00100,  B01110,  B11111,  B00100,  B00100,  B00100,  B00000,  B00000
};
byte sageataJos[] = {
  B00000,  B00000,  B00100,  B00100,  B00100,  B11111,  B01110,  B00100
};
byte sageataDreapta[] = {
  B00000,  B00100,  B00110,  B11111,  B00110,  B00100,  B00000,  B00000
};
byte sageataStanga[] = { 
  B00000,  B00100,  B01100,  B11111,  B01100,  B00100,  B00000,  B00000
};
byte sad[] = {
  B00000,  B01010,  B00000,  B00000,  B01110,  B10001,  B00000,  B00000
};
byte lol[] = {
  B00000,  B01010,  B00000,  B00000,  B11111,  B10001,  B01110,  B00000
};
void setup() {
  lcd.begin(16,4); 
  lcd.setCursor ( 0, 0 ); 
  lcd.print (" www.");  
  lcd.setCursor (0, 1 ); 
  lcd.print ("electronicstore");
  lcd.setCursor (0, 2 );
  lcd.print ("            .ro");
  lcd.setCursor (0, 3 );
  lcd.print ("****************");
  delay (1500); 
  lcd.clear(); 
  lcd.setCursor ( 0, 0 ); 
  lcd.print ("Simboluri");  
  lcd.setCursor (0, 1 ); 
  lcd.print ("grafice");
  lcd.setCursor (0, 2 );
  lcd.print ("personalizate");
  lcd.setCursor (0, 3 );
  lcd.print ("****************");
  delay (1500); 
  lcd.clear();
  lcd.createChar(0, lacatInchis);
  lcd.createChar(1, lacatDeschis);
  lcd.createChar(2, sageataStanga);
  lcd.createChar(3, sageataDreapta);
  lcd.createChar(4, sageataSus);
  lcd.createChar(5, sageataJos);
  lcd.createChar(6, sad);
  lcd.createChar(7, lol);
}

void loop() {
  lcd.setCursor ( 0, 0 );
  lcd.print("simboluri grafice");
  lcd.setCursor (0,2 ); 
  lcd.print ("electronicstore");
  lcd.setCursor (0, 3 );
  lcd.print ("            .ro");
  delay(1000);
  lcd.setCursor ( 0, 1 );
  lcd.write(byte(0)); 
  delay(500);
  lcd.setCursor ( 2, 1 );
  lcd.write(byte(1));
  delay(500); 
  lcd.setCursor ( 4, 1 );
  lcd.write(byte(2));
  delay(500); 
  lcd.setCursor ( 6, 1 );
  lcd.write(byte(3));
  delay(500); 
  lcd.setCursor ( 8, 1 );
  lcd.write(byte(4));
  delay(500);
  lcd.setCursor ( 10, 1 );
  lcd.write(byte(5));
  delay(500);
  lcd.setCursor ( 12, 1 );
  lcd.write(byte(6));
  delay(500);
  lcd.setCursor ( 14, 1 );
  lcd.write(byte(7));
  delay(500);
  lcd.clear();
  delay(200);        

}

Daca dorim sa folosim alte iconite am realizat mai jos o colectie din care puteti alege ce iconita doriti si sa o folositi in aplicatia voasrta:

byte lacatDeschis[] = {
  B01110,
  B10001,
  B10000,
  B10000,
  B11111,
  B11011,
  B11011,
  B11111
};


byte impuls[] = {
  B00000,
  B00000,
  B01110,
  B01010,
  B01010,
  B01010,
  B01010,
  B11011
};


byte ceas[] = {
 B01110,
  B10101,
  B10111,
  B10001,
  B01110,
  B00000,
  B00000,
  B00000
};


byte clepsidra[] = {
  B00000,
  B11111,
  B11111,
  B01110,
  B00100,
  B01010,
  B10001,
  B11111
};


byte robotel[] = {
  B11111,
  B10101,
  B11111,
  B11111,
  B01110,
  B01010,
  B11011,
  B00000
};


byte ohm[] = {
  B00000,
  B01110,
  B10001,
  B10001,
  B10001,
  B01010,
  B11011,
  B00000
};

byte steluta[] = {
  B00000,
  B00000,
  B00100,
  B00100,
  B11111,
  B01110,
  B01010,
  B10001
};

byte inima[] = {
  B00000,
  B00000,
  B01010,
  B11111,
  B11111,
  B01110,
  B00100,
  B00000
};

byte clopot[] = {
  B00000,
  B00000,
  B00100,
  B01110,
  B01110,
  B11111,
  B00100,
  B00000
};

byte craniu[] = {
  B00000,
  B00000,
  B01110,
  B10101,
  B11011,
  B01110,
  B01110,
  B00000
};

byte peste[] = {
  B10000,
  B00000,
  B01000,
  B10000,
  B00000,
  B01101,
  B11110,
  B01101
};

byte soare[] = {
  B00000,
  B00100,
  B10101,
  B01110,
  B11111,
  B01110,
  B10101,
  B00100
};

byte termometru[] = {
  B00100,
  B01010,
  B01010,
  B01110,
  B01110,
  B11111,
  B11111,
  B01110
};

byte picatura[] = {
  B00100,
  B00100,
  B01010,
  B01010,
  B10001,
  B10001,
  B10001,
  B01110
};

byte batery1[] = {
  B01110,
  B11011,
  B10001,
  B10001,
  B10001,
  B10001,
  B10001,
  B11111
};


byte batery2[] = {
  B01110,
  B11011,
  B10001,
  B10001,
  B10001,
  B10001,
  B11111,
  B11111
};


byte batery3[] = {
  B01110,
  B11011,
  B10001,
  B10001,
  B10001,
  B11111,
  B11111,
  B11111
};


byte batery4[] = {
  B01110,
  B11011,
  B10001,
  B10001,
  B11111,
  B11111,
  B11111,
  B11111
};



byte batery5[] = {
  B01110,
  B11011,
  B10001,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111
};

byte batery6[] = {
  B01110,
  B11011,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111
};

byte batery7[] = {
  B01110,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111
};

byte batery8[] = {
  B01110,
  B11111,
  B10101,
  B10101,
  B11011,
  B11011,
  B11111,
  B11111
};

byte celsius[] = {
  B00110,
  B01001,
  B01001,
  B00110,
  B00000,
  B00000,
  B00000,
  B00000
};

byte notaMuzicala[] = {
  B00001,
  B00011,
  B00101,
  B01001,
  B01001,
  B01011,
  B11011,
  B11000
};

byte difuzor[] = {
  B00001,
  B00011,
  B00111,
  B11111,
  B11111,
  B00111,
  B00011,
  B00001
};

byte stecher[] = {
  B01010,
  B01010,
  B11111,
  B10001,
  B10001,
  B01110,
  B00100,
  B00100
};

byte check[] = {
  B00000,
  B00000,
  B00000,
  B00001,
  B00011,
  B10110,
  B11100,
  B01000
};

byte omulet[] = {
  B01110,
  B01110,
  B00100,
  B01110,
  B10101,
  B00100,
  B01010,
  B01010
};

byte sageataSus[] = {
  B00100,
  B01110,
  B11111,
  B00100,
  B00100,
  B00100,
  B00000,
  B00000
};

byte sageataJos[] = {
  B00000,
  B00000,
  B00100,
  B00100,
  B00100,
  B11111,
  B01110,
  B00100
};


byte smyle[] = {
  B00000,
  B00000,
  B01010,
  B00000,
  B00000,
  B10001,
  B01110,
  B00000
};

byte lol[] = {
  B00000,
  B01010,
  B00000,
  B00000,
  B11111,
  B10001,
  B01110,
  B00000
};

byte sad[] = {
  B00000,
  B01010,
  B00000,
  B00000,
  B01110,
  B10001,
  B00000,
  B00000
};

byte sageataDreapta[] = {
  B00000,
  B00100,
  B00110,
  B11111,
  B00110,
  B00100,
  B00000,
  B00000
};

byte sageataStanga[] = {
  B00000,
  B00100,
  B01100,
  B11111,
  B01100,
  B00100,
  B00000,
  B00000
};

 Un filmulet cu montajul in functione este mai jos:

Autentificare