Sadržaj:
2025 Autor: John Day | [email protected]. Zadnja promjena: 2025-01-13 06:57
Pozdrav svima
U ovom obrazovanju želim uvesti LCD5110_GRAPH biblioteku i funkcije bitmap grafike. Odlučio sam ovo jer ako vidite projekt Space Race Game na mojoj stranici, nisam vam pokazao kako možete napraviti bitmap grafiku. Započnimo…
Korak 1: Značajke i povezivanje 5110LCD zaslona
Značajke:
- 84 × 48 piksela
- Napajanje 3.3V
Priključak:
- VCC -> Arduino 3.3V (ili 5v)
- BL -> Arduino pin 3 (pwm pin)
- GND -> Arduino GND
- CLK (SCLK) -> Arduino pin 8
- DIN (MOSI) -> Arduino pin 9
- DC -> Arduino pin 10
- CE ili CS -> Arduino pin 12
- RST (RESET) -> Arduino pin 11
Korak 2: BMP DATOTEKA
Pokazat ću vam korak po korak kako stvaramo bmp datoteku.
1-Napravite grafiku. Za ovo koristim Photo Editor:
- Uđite u uređivač fotografija
- Unesite gumb "Kreiraj novi"
- Odaberite širinu = 84 i visinu = 48
- Nacrtajte ono što želite
- Spremi kao.jpg
2-Pretvorite-j.webp
- Prenesite svoju-j.webp" />
- Pretvoriti
- Uštedjeti
3-Stvorite.c datoteku. Za ovo koristim LCD pomoćnik:
- Dowland it
- Unesite gumb "datoteka", a zatim "Učitaj sliku"
- Unesite "Spremi izlaz"
- Spremite.c format
4-Zalijepite.c datoteku u mapu koda koju koristite.
Korak 3: KOD
Koristim 5110LCD_Graph i pokazat ću vam neke funkcije. Ako želite naučiti sve nalaze, spustite pdf datoteku.
#include // uključi biblioteku
vanjski uint8_t SAT ; // opisuje.c datoteku
int BL = 3; // opisuje pozadinsko svjetlo
LCD5110 LCD (8, 9, 10, 11, 12); // naziv LCD5110 (clk, din, dc, rst, ce);
void setup () {
pinMode (BL, OUTPUT); lcd. InitLCD (); //name. InitLCD (); pokretanje zaslona lcd.setContrast (55); //name.setContrast (); postavite kontrast (od 0 do 127)}
void loop () {{100} {101}
analogWrite (BL, 330); lcd.clrScr (); //name.clrScr (); očisti zaslon lcd.drawBitmap (0, 0, SAT, 84, 48); //ime.drawBitmap(x, y, ime (.c), širina (.c), visina (.c)); lcd.update (); //name.update (); ažuriraj zaslon}
// --------------------- IZRADI NOVU KARTICU ------------------------ ------------------------ // Datoteka koju generira LCD pomoćnik // https://en.radzio.dxp.pl/bitmap_converter/ //- -------------------------------------------------- --------------------------- #include // uključi ovu knjižnicu za korištenje PROGMEM-a // PROGMEM pomaže u korištenju male RAM memorije const unsigned char SAT PROGRAM = {0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3x, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0xFF, 0xFB, 0xFF, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1Fx, 0x1, 0x1, 0x1, 0x1, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0xFF, 0xF7, 0xFF, 0x1F, 0x1F, 0x1F, 0x17, 0x1E, 0x1E, 0x1F, 0x1F, 0x1F, 0x1F, 0x1, 0x1, 0x1, 0x1, 0x1, 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, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xE6, 0xFE, 0xFF, 0xFF, 0xFD, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFx, 0xFx,, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0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