#include <DMDESP.h>
#include <fonts/DejaVuSansBold9.h>
//SETUP DMD
#define DISPLAYS_WIDE 1
#define DISPLAYS_HIGH 1
DMDESP Disp(DISPLAYS_WIDE, DISPLAYS_HIGH);
int button1 = 5;
int sayac = 0;
int Adet = 0;
byte resetButton = 4;
bool pressed = false;
void setup() {
// DMDESP Setup
Disp.start(); // Jalankan library DMDESP
Disp.setBrightness(20); // Tingkat kecerahan
Disp.setFont(DejaVuSansBold9); // Tentukan huruf
pinMode(button1, INPUT_PULLUP);
pinMode(resetButton, INPUT_PULLUP);
}
void loop() {
if (digitalRead(resetButton) == LOW) {
Adet = 0;
Disp.clear();
}
if (digitalRead(button1) == LOW && pressed == false) {
pressed = true;
Adet++;
}
if (digitalRead(button1) == HIGH) {
pressed = false;
}
Disp.loop();
String sayac = String(Adet);
Disp.drawText(6, 4, sayac);
}