Sommario:

LCD5110 Educazione alla grafica: 4 passaggi
LCD5110 Educazione alla grafica: 4 passaggi

Video: LCD5110 Educazione alla grafica: 4 passaggi

Video: LCD5110 Educazione alla grafica: 4 passaggi
Video: DHT11 Sensor And NOKIA 5110 LCD Interfacing With Arduino | NOKIA3110 2024, Novembre
Anonim
LCD5110 Educazione grafica
LCD5110 Educazione grafica

Ciao a tutti

In questa formazione, introdurrò la libreria LCD5110_GRAPH e le funzioni relative a Bitmap Graphic. Ho deciso questo perché se vedi il progetto Space Race Game nella mia pagina, non ti ho mostrato come puoi creare una grafica bitmap. Cominciamo…

Passaggio 1: caratteristiche e connessione del display LCD 5110

Caratteristiche e connessione del display LCD 5110
Caratteristiche e connessione del display LCD 5110

Caratteristiche:

  • 84 × 48 pixel
  • Alimentazione 3.3V

Connessione:

  • VCC -> Arduino 3.3V (o 5v)
  • BL -> Arduino pin 3 (pin pwm)
  • GND -> Arduino GND
  • CLK (SCLK) -> Arduino pin 8
  • DIN (MOSI) -> Arduino pin 9
  • DC -> Arduino pin 10
  • CE o CS -> Arduino pin 12
  • RST (RESET) -> Arduino pin 11

Passaggio 2: FILE BMP

FILE BMP
FILE BMP
FILE BMP
FILE BMP
FILE BMP
FILE BMP
FILE BMP
FILE BMP

Ti mostrerò passo dopo passo come creiamo un file bmp.

1-Crea della grafica. Uso Photo Editor per questo:

  • Entra nell'editor di foto
  • Inserisci il pulsante "Crea nuovo"
  • Seleziona larghezza=84 e altezza=48
  • Disegna quello che vuoi
  • Salva come.jpg

2-Converti il file-j.webp

  • Carica il tuo file.jpg
  • Convertire
  • Salva

3-Crea file.c. Uso LCD Assistant per questo:

  • Dowland è
  • Inserisci il pulsante "file" quindi "Carica immagine"
  • Inserisci "Salva output"
  • Assicurati di salvare il formato.c

4-Incolla il file.c nella cartella del codice che usi.

Passaggio 3: CODICE

CODICE
CODICE

Io uso 5110LCD_Graph e ti mostrerò alcune funzioni. Se vuoi imparare tutte le funzioni, scarica il file pdf.

#include //include libreria

extern uint8_t SAT; //descrivi il file.c

int BL=3; //descrivi la retroilluminazione

LCD5110 LCD (8, 9, 10, 11, 12); //Nome LCD5110(clk, din, dc, rst, ce);

void setup() {

pinMode(BL, OUTPUT); lcd. InitLCD(); //nome. InitLCD(); inizializza lo schermo lcd.setContrast(55); //nome.setContrast(); imposta contrasto (tra 0 e 127) }

ciclo vuoto() {

analogWrite(BL, 330); lcd.clrScr(); //nome.clrScr(); cancella lo schermo lcd.drawBitmap(0, 0, SAT, 84, 48); //nome.drawBitmap(x, y, nome(.c), larghezza(.c), altezza(.c)); lcd.update(); //nome.aggiornamento(); aggiorna lo schermo }

//---------------------CREA NUOVA SCHEDA---------- ----------// File generato da LCD Assistant // https://en.radzio.dxp.pl/bitmap_converter/ //- --------------------------------------------------- ------------- #include //include questa libreria per l'utilizzo di PROGMEM //PROGMEM aiuta a utilizzare un piccolo utilizzo della RAM const unsigned char SAT PROGRAMMA = { 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3,0x3,0x3F, 0x3F, 0x3F 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0xFF, 0xFB, 0xFF, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0xFF, 0xF7, 0xFF, 0x1F, 0x1F, 0x1F, 0x17, 0x1E, 0x1E, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1,F, 0x1,F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE 0xFE, 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