Sadržaj:
2025 Autor: John Day | [email protected]. Zadnja izmjena: 2025-01-13 06:57
Zdravo svima
U ovom obrazovanju želim uvesti LCD5110_GRAPH biblioteku i funkcije bitmap grafike. Odlučio sam se na ovome jer ako vidite projekt Space Race Game na mojoj stranici, nisam vam pokazao kako možete napraviti bitmap grafiku. Počnimo…
Korak 1: Karakteristike i povezivanje 5110LCD ekrana
Karakteristike:
- 84 × 48 piksela
- Suplly 3.3V
Veza:
- 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
Korak po korak ću vam pokazati kako stvaramo bmp datoteku.
1-Napravite grafiku. Za ovo koristim Uređivač fotografija:
- Uđite u uređivač fotografija
- Unesite dugme "Kreiraj novo"
- Odaberite širinu = 84 i visinu = 48
- Nacrtajte šta želite
- Sačuvaj kao.jpg
2-Pretvorite-j.webp
- Otpremite svoju-j.webp" />
- Pretvoriti
- Save
3-Kreirajte.c datoteku. Za ovo koristim LCD pomoćnik:
- Dowland it
- Unesite dugme "datoteka", a zatim "Učitaj sliku"
- Unesite "Sačuvaj izlaz"
- Obavezno sačuvajte.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 naredbe, spustite pdf datoteku.
#include // uključuje biblioteku
extern 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 (); pokrenite ekran lcd.setContrast (55); //name.setContrast (); postavite kontrast (od 0 do 127)}
void loop () {{100} {101}
analogWrite (BL, 330); lcd.clrScr (); //name.clrScr (); obriši ekran lcd.drawBitmap (0, 0, SAT, 84, 48); //name.drawBitmap(x, y, name (.c), width (.c), hight (.c)); lcd.update (); //name.update (); ažurirajte ekran}
// --------------------- NAPRAVI NOVU KARTICU ------------------------ ------------------------ // Datoteka koju generira LCD pomoćnik // https://en.radzio.dxp.pl/bitmap_converter/ //- -------------------------------------------------- --------------------------- #include // uključi ovu biblioteku za korištenje PROGMEM-a // PROGMEM pomaže pri 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, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F 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, 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, 0xFE, 0xE6, 0xFE, 0xFF, 0xFF, 0xFD, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF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