Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding delay cause to display #7

Open
eklavyainfo opened this issue Mar 12, 2022 · 0 comments
Open

Adding delay cause to display #7

eklavyainfo opened this issue Mar 12, 2022 · 0 comments

Comments

@eklavyainfo
Copy link

eklavyainfo commented Mar 12, 2022

/*

#include <DMDESP.h>
#include <fonts/ElektronMart6x8.h>

//SETUP DMD
#define DISPLAYS_WIDE 1 // Kolom Panel
#define DISPLAYS_HIGH 1 // Baris Panel
DMDESP Disp(DISPLAYS_WIDE, DISPLAYS_HIGH); // Jumlah Panel P10 yang digunakan (KOLOM,BARIS)

//----------------------------------------------------------------------
// SETUP

void setup() {

// DMDESP Setup
Disp.start(); // Jalankan library DMDESP
Disp.setBrightness(200); // Tingkat kecerahan
Disp.setFont(ElektronMart6x8); // Tentukan huruf

}

//----------------------------------------------------------------------
// LOOP

void loop() {

Disp.loop(); // Jalankan Disp loop untuk refresh LED

Disp.drawText(0,0,"DMDESP"); // Tampilkan teks
TeksJalan(8, 50); // Tampilkan teks berjalan TeksJalan(posisi y, kecepatan);

delay(100);

}

//--------------------------
// TAMPILKAN SCROLLING TEKS

static char *teks[] = {"Teks berjalan dengan DMDESP"};

void TeksJalan(int y, uint8_t kecepatan) {

static uint32_t pM;
static uint32_t x;
int width = Disp.width();
Disp.setFont(ElektronMart6x8);
int fullScroll = Disp.textWidth(teks[0]) + width;
if((millis() - pM) > kecepatan) {
pM = millis();
if (x < fullScroll) {
++x;
} else {
x = 0;
return;
}
Disp.drawText(width - x, y, teks[0]);
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant