Innholdsfortegnelse:
2025 Forfatter: John Day | [email protected]. Sist endret: 2025-01-13 06:58
Hei alle sammen
I denne utdanningen kommer jeg til å introdusere LCD5110_GRAPH -biblioteket og funksjonene om Bitmap Graphic. Jeg bestemte meg for dette, for hvis du ser Space Race Game -prosjektet på siden min, viste jeg deg ikke hvordan du kan lage en bitmap -grafikk. La oss begynne…
Trinn 1: Funksjoner og tilkobling av 5110LCD -skjerm
Funksjoner:
- 84 × 48 piksler
- Tilstrekkelig 3.3V
Forbindelse:
- VCC -> Arduino 3.3V (eller 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 eller CS -> Arduino pin 12
- RST (RESET) -> Arduino pin 11
Trinn 2: BMP -FIL
Jeg vil trinnvis vise deg hvordan vi lager en bmp -fil.
1-Lag litt grafikk. Jeg bruker Photo Editor for dette:
- Gå inn i Photo Editor
- Skriv inn "Opprett ny" -knappen
- Velg bredde = 84 og høyde = 48
- Tegn det du vil
- Lagre som.jpg
2-Konverter.jpg-fil til.bmp. Jeg bruker Convertio for dette:
- Last opp-j.webp" />
- Konvertere
- Lagre
3-Lag.c-fil. Jeg bruker LCD Assistant til dette:
- Dowland det
- Skriv inn "fil" -knappen og deretter "Last inn bilde"
- Skriv inn "Lagre utdata"
- Husk å lagre.c -format
4-lim inn.c-filen i kodemappen du bruker.
Trinn 3: KODE
Jeg bruker 5110LCD_Graph, og jeg vil vise deg noen funksjoner. Hvis du vil lære alle funksjonene, kan du laste ned pdf -filen.
#include // inkludere bibliotek
ekstern uint8_t SAT ; // beskriv.c -fil
int BL = 3; // beskriv bakgrunnslys
LCD5110 lcd (8, 9, 10, 11, 12); // LCD5110 navn (clk, din, dc, rst, ce);
ugyldig oppsett () {
pinMode (BL, OUTPUT); lcd. InitLCD (); //name. InitLCD (); start skjermen lcd.setContrast (55); //name.setContrast (); angi kontrast (mellom 0 til 127)}
void loop () {
analogWrite (BL, 330); lcd.clrScr (); //name.clrScr (); tøm skjermen lcd.drawBitmap (0, 0, SAT, 84, 48); //name.drawBitmap(x, y, navn (.c), bredde (.c), høyde (.c)); lcd.update (); //name.update (); oppdater skjermen}
// --------------------- Lag en ny fane ------------------------ ------------------------ // Fil generert av LCD Assistant // https://en.radzio.dxp.pl/bitmap_converter/ //- -------------------------------------------------- --------------------------- #include // inkludere dette biblioteket for bruk av PROGMEM // PROGMEM hjelper til med bruk av lite RAM const usignert char SAT PROGMEM = {0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3, 0x3, 0x3 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0xFF, 0xFB, 0xFF, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 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, 0xF, 0xF, 0xF, 0xF, 0xF 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, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x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