Translate

ECG AD8232 ARDUINO

ECG AD8232 ARDUINO
 

      Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara mengakses modul sensor ECG AD8232 dengan menggunakan Arduino Uno. jadi alat ini akan menampilkan sinyal PQRS di serial monitor atau serial plotter Arduino. alat ini bisa dikembangkan lagi untuk keperluan yang lebih canggih misal sinyal ECG ditampilkan ke Android atau ke internet. untuk lebih jelasnya berikut adalah skema dan kodingnya. 
 
Link Sumber : https://how2electronics.com/ecg-monitoring-with-ad8232-ecg-sensor-arduino/
 
 
a. Skema 
 

 
 
b. Cara Pemasangan ke Tubuh
 

 
 
c. Program Arduino Uno
 
void setup() {
// initialize the serial communication:
Serial.begin(9600);
pinMode(10, INPUT); // Setup for leads off detection LO +
pinMode(11, INPUT); // Setup for leads off detection LO -
 
}
 
void loop() {
 
if((digitalRead(10) == 1)||(digitalRead(11) == 1)){
Serial.println('!');
}
else{
// send the value of analog input 0:
Serial.println(analogRead(A0));
}
//Wait for a bit to keep serial data from saturating
delay(1);
}
 
 
 
d. VIDEO HASILNYA
 

 

Timer Countdown, Jam Digital, Stopwatch, Lap Counter Panel P10 RGB HUB75 ARUINO

Timer Countdown, Jam Digital, Stopwatch, Lap Counter Panel P10 RGB HUB75 ARDUINO


         Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang memiliki 4 fitur berbeda yaitu Timer Countdown, Stopwatch, Jam Digital, Lap Counter dengan penampilnya menggunakan panel P10 RGB HUB75. untuk lebih jelasnya berikut adalah koding dan komponennya. 



a. Arduino Uno




b. Panel P10 RGB





c. Modul RTC DS3231






d. Program Arduino IDE

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DS3231.h>
#include <Adafruit_GFX.h>   
#include <RGBmatrixPanel.h> 
LiquidCrystal_I2C lcd(0x27, 16, 2);

DS3231  rtc(SDA, SCL);
Time  t;

#define F2(progmem_ptr) (const __FlashStringHelper *)progmem_ptr

#define CLK 8  // MUST be on PORTB! (Use pin 11 on Mega)
#define LAT A3
#define OE  9
#define A   A0
#define B   A1
#define C   A2

RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false);

String sjam,smenit,sdetik;
int jam,menit,detik;
int pilih;
float xjam, xmenit, xdetik, xmiliDetik;
int xjamx, xmenitx, xdetikx, xmiliDetikx;
unsigned long over;

int lap;
int btset = 10;
int btup = 11;
int btdown = 12;
int btok = 13;
int btsetx;
int btupx;
int btdownx;
int btokx;
int countdown;
int detikku;
int mulai;
int seconds;
int cs;
long start_time = 0;
int jams,menits;
unsigned long mulaix, selesai, dataStopWatch;
int i=0;
int fPaus = 0;
long lastButton = 0; 
long delayAntiBouncing = 50; 
long dataPaus = 0;


void setup()
{
  lcd.begin();
  lcd.clear();
  lcd.noCursor();
  pinMode(btset,INPUT_PULLUP);
  pinMode(btup,INPUT_PULLUP);
  pinMode(btdown,INPUT_PULLUP);
  pinMode(btok,INPUT_PULLUP);
  matrix.begin();
  matrix.setTextWrap(false); // Allow text to run off right edge
  matrix.fillScreen(0);
  rtc.begin();
  //rtc.setDOW(THURSDAY);     // Set Day-of-Week to SUNDAY
  //rtc.setTime(15, 53, 0);     // Set the time to 12:00:00 (24hr format)
  //rtc.setDate(13, 5, 2022);   // Set the date to January 1st, 2014
}

void loop()
{
    
btsetx = digitalRead(btset);
btupx = digitalRead(btup);
btdownx = digitalRead(btdown);
btokx = digitalRead(btok);

if(btupx == 0){
delay(200);
pilih++;  
}

if(btdownx == 0){
delay(200);
pilih--;  
}

if(pilih > 3){
pilih = 0;  
}

if(pilih < 0){
pilih = 3;  
}

if(pilih == 0){
  lcd.setCursor(0,0);
  lcd.print("1.Countdown    ");
}

if(pilih == 1){
  lcd.setCursor(0,0);
  lcd.print("2.Stopwatch    ");
}

if(pilih == 2){
  lcd.setCursor(0,0);
  lcd.print("3.Jam          ");
}

if(pilih == 3){
  lcd.setCursor(0,0);
  lcd.print("4.Lap Counter  ");
}

if((btokx == 0)&&(pilih == 0)){
lcd.clear();
delay(2000);
countdownku();  
}

if((btokx == 0)&&(pilih == 1)){
lcd.clear();
delay(2000);
lcd.print("  Tekan Tombol");
lcd.setCursor(0, 1); 
lcd.print("  Start / Stop");
stopwatch();  
}

if((btokx == 0)&&(pilih == 2)){
lcd.clear();
delay(2000);
jamku();  
}

if((btokx == 0)&&(pilih == 3)){
lcd.clear();
delay(2000);
lapcounter();  
}

}


void lapcounter(){

lcd.setCursor(0,0);
lcd.print("Lap: ");
lcd.print(lap);
lcd.print("   ");

btsetx = digitalRead(btset);
btupx = digitalRead(btup);
btdownx = digitalRead(btdown);
btokx = digitalRead(btok);

if(btupx == 0){
delay(200);
lap++;  
}

if(btdownx == 0){
delay(200);
lap--;  
}

if(btokx == 0){
lcd.clear();
delay(2000);
return; 
}

if(lap <= 9){
matrix.setTextSize(2);
matrix.setTextColor(matrix.Color444(1, 0, 0));
matrix.setCursor(10, 1); //x,y
matrix.print(lap);   
}

if(lap > 9){
matrix.setTextSize(2);
matrix.setTextColor(matrix.Color444(1, 0, 0));
matrix.setCursor(4, 1); //x,y
matrix.print(lap);   
}

delay(100);
matrix.fillScreen(0);
 

lapcounter();  
}


void setjam(){

lcd.setCursor(0,0);
lcd.print("Jam: ");
lcd.print(jam);
lcd.print("   ");

btsetx = digitalRead(btset);
btupx = digitalRead(btup);
btdownx = digitalRead(btdown);
btokx = digitalRead(btok);

if(btupx == 0){
delay(200);
jam++;  
}

if(btdownx == 0){
delay(200);
jam--;  
}

if(btokx == 0){
lcd.clear();
delay(2000);
return; 
}

if(jam > 23){
jam = 0;
}

if(jam < 0){
jam = 23;
}  

setjam();
}


void setmenit(){

  lcd.setCursor(0,0);
  lcd.print("Min: ");
  lcd.print(menit);
  lcd.print("   ");

btsetx = digitalRead(btset);
btupx = digitalRead(btup);
btdownx = digitalRead(btdown);
btokx = digitalRead(btok);

if(btupx == 0){
delay(200);
menit++;  
}

if(btdownx == 0){
delay(200);
menit--;  
}

if(btokx == 0){
lcd.clear();
delay(2000);
return; 
}

if(menit > 59){
menit = 0;
}

if(menit < 0){
menit = 59;
}  

setmenit();
}


void setdetik(){

  lcd.setCursor(0,0);
  lcd.print("Detik: ");
  lcd.print(detik);
  lcd.print("   ");

btsetx = digitalRead(btset);
btupx = digitalRead(btup);
btdownx = digitalRead(btdown);
btokx = digitalRead(btok);

if(btupx == 0){
delay(200);
detik++;  
}

if(btdownx == 0){
delay(200);
detik--;  
}

if(btokx == 0){
lcd.clear();
delay(2000);
t.hour = jam;
t.min = menit;
t.sec = detik;
rtc.setTime(jam,menit,detik);     // Set the time to 12:00:00 (24hr format)
return; 
}

if(detik > 59){
detik = 0;
}

if(detik < 0){
detik = 59;
}  

setdetik();
}


void jamku(){
  
btsetx = digitalRead(btset);
btupx = digitalRead(btup);
btdownx = digitalRead(btdown);
btokx = digitalRead(btok);

if((btupx == 0)&&(btdownx == 0)){
lcd.clear();
delay(2000);
return;
}

if(btsetx == 0){
delay(200);
lcd.clear();  
setjam();
setmenit();
setdetik();  
}

 t = rtc.getTime();
 
  lcd.setCursor(0,0);
  lcd.print(t.hour);
  lcd.print(":");
  lcd.print(t.min);
  lcd.print(":");
  lcd.print(t.sec);
  lcd.print("   ");

  matrix.setTextSize(1);
  matrix.setTextColor(matrix.Color444(1, 0, 0));
  matrix.setCursor(1, 8); //x,y
  matrix.print(t.hour);
  matrix.setTextColor(matrix.Color444(3, 1, 0));
  matrix.print(":");
  matrix.setTextColor(matrix.Color444(0, 1, 0));
  matrix.print(t.min);
 
  matrix.setCursor(10, 1); //x,y
  matrix.setTextColor(matrix.Color444(0, 0, 1));
  matrix.print(t.sec);
 
  delay(1000);
  matrix.fillScreen(0);
  
jamku();  
}



void countdownku(){
matrix.setTextSize(2);
    
t = rtc.getTime();

btsetx = digitalRead(btset);
btupx = digitalRead(btup);
btdownx = digitalRead(btdown);
btokx = digitalRead(btok);

if((btupx == 0)&&(btdownx == 0)){
lcd.clear();
delay(2000);
return;
}

if(btsetx == 0){
delay(200);
lcd.clear();  
setjam();
setmenit();
setdetik();  
}

  lcd.setCursor(0,0);
  lcd.print(t.hour);
  lcd.print(":");
  lcd.print(t.min);
  lcd.print(":");
  lcd.print(t.sec);
  lcd.print("   ");

detikku = 59 - t.sec;

if(t.sec == 30){

  matrix.drawLine(4, 3, 5, 3 , matrix.Color333(1, 0, 0));
  matrix.drawLine(3, 4, 6, 4 , matrix.Color333(1, 0, 0));
  matrix.drawLine(2, 5, 7, 5 , matrix.Color333(1, 0, 0));
  matrix.drawLine(1, 6, 8, 6 , matrix.Color333(1, 0, 0));
  matrix.drawLine(0, 7, 9, 7 , matrix.Color333(1, 0, 0));
  matrix.drawLine(0, 8, 9, 8 , matrix.Color333(1, 0, 0));
  matrix.drawLine(1, 9, 8, 9 , matrix.Color333(1, 0, 0));
  matrix.drawLine(2, 10, 7, 10 , matrix.Color333(1, 0, 0));
  matrix.drawLine(3, 11, 6, 11 , matrix.Color333(1, 0, 0));
  matrix.drawLine(4, 12, 5, 12 , matrix.Color333(1, 0, 0));

countdown = 30;
matrix.setTextColor(matrix.Color444(1, 1, 1));
matrix.setCursor(10, 1); //x,y
matrix.print(countdown); 
delay(2000);
matrix.fillScreen(0);
}

if(detikku == 10){
  
  matrix.drawLine(4, 3, 5, 3 , matrix.Color333(1, 0, 0));
  matrix.drawLine(3, 4, 6, 4 , matrix.Color333(1, 0, 0));
  matrix.drawLine(2, 5, 7, 5 , matrix.Color333(1, 0, 0));
  matrix.drawLine(1, 6, 8, 6 , matrix.Color333(1, 0, 0));
  matrix.drawLine(0, 7, 9, 7 , matrix.Color333(1, 0, 0));
  matrix.drawLine(0, 8, 9, 8 , matrix.Color333(1, 0, 0));
  matrix.drawLine(1, 9, 8, 9 , matrix.Color333(1, 0, 0));
  matrix.drawLine(2, 10, 7, 10 , matrix.Color333(1, 0, 0));
  matrix.drawLine(3, 11, 6, 11 , matrix.Color333(1, 0, 0));
  matrix.drawLine(4, 12, 5, 12 , matrix.Color333(1, 0, 0));

countdown = 10;
  
matrix.setTextColor(matrix.Color444(1, 1, 1));
matrix.setCursor(10, 1); //x,y
matrix.print(countdown);   
delay(1000);
matrix.fillScreen(0);
}

if((detikku > 0 )&&(detikku <= 5)){
matrix.setTextColor(matrix.Color444(1, 1, 1));
matrix.setCursor(15, 1); //x,y
matrix.print(detikku);   
}

if(detikku > 0){
  matrix.drawLine(4, 3, 5, 3 , matrix.Color333(1, 0, 0));
  matrix.drawLine(3, 4, 6, 4 , matrix.Color333(1, 0, 0));
  matrix.drawLine(2, 5, 7, 5 , matrix.Color333(1, 0, 0));
  matrix.drawLine(1, 6, 8, 6 , matrix.Color333(1, 0, 0));
  matrix.drawLine(0, 7, 9, 7 , matrix.Color333(1, 0, 0));
  matrix.drawLine(0, 8, 9, 8 , matrix.Color333(1, 0, 0));
  matrix.drawLine(1, 9, 8, 9 , matrix.Color333(1, 0, 0));
  matrix.drawLine(2, 10, 7, 10 , matrix.Color333(1, 0, 0));
  matrix.drawLine(3, 11, 6, 11 , matrix.Color333(1, 0, 0));
  matrix.drawLine(4, 12, 5, 12 , matrix.Color333(1, 0, 0));
}

if(detikku == 0){
  matrix.drawLine(4, 3, 5, 3 , matrix.Color333(0, 1, 0));
  matrix.drawLine(3, 4, 6, 4 , matrix.Color333(0, 1, 0));
  matrix.drawLine(2, 5, 7, 5 , matrix.Color333(0, 1, 0));
  matrix.drawLine(1, 6, 8, 6 , matrix.Color333(0, 1, 0));
  matrix.drawLine(0, 7, 9, 7 , matrix.Color333(0, 1, 0));
  matrix.drawLine(0, 8, 9, 8 , matrix.Color333(0, 1, 0));
  matrix.drawLine(1, 9, 8, 9 , matrix.Color333(0, 1, 0));
  matrix.drawLine(2, 10, 7, 10 , matrix.Color333(0, 1, 0));
  matrix.drawLine(3, 11, 6, 11 , matrix.Color333(0, 1, 0));
  matrix.drawLine(4, 12, 5, 12 , matrix.Color333(0, 1, 0));
  matrix.setTextColor(matrix.Color444(0, 1, 0));
  matrix.setCursor(10, 1); //x,y
  matrix.print("GO");   
  delay(3000);
  matrix.fillScreen(0);
}
  delay(1000);
  matrix.fillScreen(0);
    
countdownku();  
}



void stopwatch(){
  
btsetx = digitalRead(btset);
btupx = digitalRead(btup);
btdownx = digitalRead(btdown);
btokx = digitalRead(btok);

if((btupx == 0)&&(btdownx == 0)){
lcd.clear();
delay(2000);
return;
}

if (btsetx == 0){
  if ((millis() - lastButton) > delayAntiBouncing){
      if (i==0){
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print("Start Timer");
          mulaix = millis();
          fPaus = 0;
        }
       else if (i==1){
        lcd.setCursor(0, 0);
        lcd.print("Stop Timer  ");
        dataPaus = dataStopWatch;
        fPaus = 1;
        }
       i =!i;
      }
      lastButton = millis();
  }
  
if ((btupx == 0) && (fPaus == 1)){
  dataStopWatch = 0;
  dataPaus = 0; 
  lcd.clear();
  lcd.print("Reset Stopwatch");
  lcd.setCursor(0, 1); 
  lcd.print("0:0:0.0");  
  xjamx = 0;
  xmenitx = 0;
  xdetikx = 0;
  xmiliDetikx = 0;
 }
  
  if (i==1){
      selesai = millis(); 

      // MATH time!!!
      dataStopWatch = selesai - mulaix;
      dataStopWatch = dataPaus + dataStopWatch;

      xjam = int(dataStopWatch / 3600000);
      over = dataStopWatch % 3600000;
      xmenit = int(over / 60000);
      over = over % 60000;
      xdetik = int(over / 1000);
      xmiliDetik = over % 100;

      lcd.setCursor(0, 1);
      lcd.print(xjam, 0); 
      lcd.print(":"); 
      lcd.print(xmenit, 0);
      lcd.print(":");
      lcd.print(xdetik, 0);
      lcd.print(".");
      if (xjam < 10){
          lcd.print(xmiliDetik, 0);
          lcd.print("   ");
       }
   }

xjamx = xjam;
xmenitx = xmenit;
xdetikx = xdetik;
xmiliDetikx = xmiliDetik;
   
matrix.setTextSize(1);
matrix.setTextColor(matrix.Color444(1, 0, 0));
matrix.setCursor(1, 1); //x,y
matrix.print(xjamx);   
matrix.print(":");   
matrix.print(xmenitx);  
matrix.setCursor(1, 8); //x,y
matrix.print(xdetikx);  
matrix.print(":");   
matrix.print(xmiliDetikx);   

delay(1);
matrix.fillScreen(0);
  
stopwatch();  
}




e. VIDEO HASILNYA



Timer Counter Down Panel P10 RGB HUB75

Timer Counter Down Panel P10 RGB HUB75



        Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat menampilkan nilai countdown untuk tujuan tertentu. alat ini menggunakan panel P10 RGB dengan HUB75. pada tampilan di panel P10 terdapat simbol merah dan hijau serta terdapat pula nilai yang countdown. untuk lebih jelasnya berikut adalah program dan komponennya.  


a. Arduino Uno




b. Panel P10 RGB





c. Modul RTC DS3231





d. Program Arduino IDE

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DS3231.h>
#include <Adafruit_GFX.h>   
#include <RGBmatrixPanel.h> 
LiquidCrystal_I2C lcd(0x27, 16, 2);

DS3231  rtc(SDA, SCL);
Time  t;

#define F2(progmem_ptr) (const __FlashStringHelper *)progmem_ptr

#define CLK 8  // MUST be on PORTB! (Use pin 11 on Mega)
#define LAT A3
#define OE  9
#define A   A0
#define B   A1
#define C   A2

RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false);

String sjam,smenit,sdetik;
int jam,menit,detik;

int btset = 10;
int btup = 11;
int btdown = 12;
int btok = 13;
int btsetx;
int btupx;
int btdownx;
int btokx;
int countdown;
int detikku;


void setup()
{
  lcd.begin();
  lcd.clear();
  lcd.noCursor();
  pinMode(btset,INPUT_PULLUP);
  pinMode(btup,INPUT_PULLUP);
  pinMode(btdown,INPUT_PULLUP);
  pinMode(btok,INPUT_PULLUP);
  matrix.begin();
  matrix.setTextWrap(false); // Allow text to run off right edge
  matrix.setTextSize(2);
  matrix.fillScreen(0);
  rtc.begin();
  //rtc.setDOW(THURSDAY);     // Set Day-of-Week to SUNDAY
  //rtc.setTime(15, 53, 0);     // Set the time to 12:00:00 (24hr format)
  //rtc.setDate(13, 5, 2022);   // Set the date to January 1st, 2014
}

void loop()
{
  
t = rtc.getTime();

btsetx = digitalRead(btset);
btupx = digitalRead(btup);
btdownx = digitalRead(btdown);
btokx = digitalRead(btok);

if(btsetx == 0){
delay(200);
lcd.clear();  
setjam();
setmenit();
setdetik();  
}

  lcd.setCursor(0,0);
  lcd.print(t.hour);
  lcd.print(":");
  lcd.print(t.min);
  lcd.print(":");
  lcd.print(t.sec);
  lcd.print("   ");

detikku = 59 - t.sec;

if(t.sec == 30){

  matrix.drawLine(4, 3, 5, 3 , matrix.Color333(1, 0, 0));
  matrix.drawLine(3, 4, 6, 4 , matrix.Color333(1, 0, 0));
  matrix.drawLine(2, 5, 7, 5 , matrix.Color333(1, 0, 0));
  matrix.drawLine(1, 6, 8, 6 , matrix.Color333(1, 0, 0));
  matrix.drawLine(0, 7, 9, 7 , matrix.Color333(1, 0, 0));
  matrix.drawLine(0, 8, 9, 8 , matrix.Color333(1, 0, 0));
  matrix.drawLine(1, 9, 8, 9 , matrix.Color333(1, 0, 0));
  matrix.drawLine(2, 10, 7, 10 , matrix.Color333(1, 0, 0));
  matrix.drawLine(3, 11, 6, 11 , matrix.Color333(1, 0, 0));
  matrix.drawLine(4, 12, 5, 12 , matrix.Color333(1, 0, 0));

countdown = 30;
matrix.setTextColor(matrix.Color444(1, 1, 1));
matrix.setCursor(10, 1); //x,y
matrix.print(countdown); 
delay(2000);
matrix.fillScreen(0);
}

if(detikku == 10){
  
  matrix.drawLine(4, 3, 5, 3 , matrix.Color333(1, 0, 0));
  matrix.drawLine(3, 4, 6, 4 , matrix.Color333(1, 0, 0));
  matrix.drawLine(2, 5, 7, 5 , matrix.Color333(1, 0, 0));
  matrix.drawLine(1, 6, 8, 6 , matrix.Color333(1, 0, 0));
  matrix.drawLine(0, 7, 9, 7 , matrix.Color333(1, 0, 0));
  matrix.drawLine(0, 8, 9, 8 , matrix.Color333(1, 0, 0));
  matrix.drawLine(1, 9, 8, 9 , matrix.Color333(1, 0, 0));
  matrix.drawLine(2, 10, 7, 10 , matrix.Color333(1, 0, 0));
  matrix.drawLine(3, 11, 6, 11 , matrix.Color333(1, 0, 0));
  matrix.drawLine(4, 12, 5, 12 , matrix.Color333(1, 0, 0));

countdown = 10;
  
matrix.setTextColor(matrix.Color444(1, 1, 1));
matrix.setCursor(10, 1); //x,y
matrix.print(countdown);   
delay(1000);
matrix.fillScreen(0);
}

if((detikku > 0 )&&(detikku <= 5)){
matrix.setTextColor(matrix.Color444(1, 1, 1));
matrix.setCursor(15, 1); //x,y
matrix.print(detikku);   
}

if(detikku > 0){
  matrix.drawLine(4, 3, 5, 3 , matrix.Color333(1, 0, 0));
  matrix.drawLine(3, 4, 6, 4 , matrix.Color333(1, 0, 0));
  matrix.drawLine(2, 5, 7, 5 , matrix.Color333(1, 0, 0));
  matrix.drawLine(1, 6, 8, 6 , matrix.Color333(1, 0, 0));
  matrix.drawLine(0, 7, 9, 7 , matrix.Color333(1, 0, 0));
  matrix.drawLine(0, 8, 9, 8 , matrix.Color333(1, 0, 0));
  matrix.drawLine(1, 9, 8, 9 , matrix.Color333(1, 0, 0));
  matrix.drawLine(2, 10, 7, 10 , matrix.Color333(1, 0, 0));
  matrix.drawLine(3, 11, 6, 11 , matrix.Color333(1, 0, 0));
  matrix.drawLine(4, 12, 5, 12 , matrix.Color333(1, 0, 0));
}

if(detikku == 0){
  matrix.drawLine(4, 3, 5, 3 , matrix.Color333(0, 1, 0));
  matrix.drawLine(3, 4, 6, 4 , matrix.Color333(0, 1, 0));
  matrix.drawLine(2, 5, 7, 5 , matrix.Color333(0, 1, 0));
  matrix.drawLine(1, 6, 8, 6 , matrix.Color333(0, 1, 0));
  matrix.drawLine(0, 7, 9, 7 , matrix.Color333(0, 1, 0));
  matrix.drawLine(0, 8, 9, 8 , matrix.Color333(0, 1, 0));
  matrix.drawLine(1, 9, 8, 9 , matrix.Color333(0, 1, 0));
  matrix.drawLine(2, 10, 7, 10 , matrix.Color333(0, 1, 0));
  matrix.drawLine(3, 11, 6, 11 , matrix.Color333(0, 1, 0));
  matrix.drawLine(4, 12, 5, 12 , matrix.Color333(0, 1, 0));
  matrix.setTextColor(matrix.Color444(0, 1, 0));
  matrix.setCursor(10, 1); //x,y
  matrix.print("GO");   
  delay(3000);
  matrix.fillScreen(0);
}
  delay(1000);
  matrix.fillScreen(0);
}

void setjam(){

  lcd.setCursor(0,0);
  lcd.print("Jam: ");
  lcd.print(jam);
  lcd.print("   ");

btsetx = digitalRead(btset);
btupx = digitalRead(btup);
btdownx = digitalRead(btdown);
btokx = digitalRead(btok);

if(btupx == 0){
delay(200);
jam++;  
}

if(btdownx == 0){
delay(200);
jam--;  
}

if(btokx == 0){
lcd.clear();
delay(2000);
return; 
}

if(jam > 23){
jam = 0;
}

if(jam < 0){
jam = 23;
}  

setjam();
}


void setmenit(){

  lcd.setCursor(0,0);
  lcd.print("Min: ");
  lcd.print(menit);
  lcd.print("   ");

btsetx = digitalRead(btset);
btupx = digitalRead(btup);
btdownx = digitalRead(btdown);
btokx = digitalRead(btok);

if(btupx == 0){
delay(200);
menit++;  
}

if(btdownx == 0){
delay(200);
menit--;  
}

if(btokx == 0){
lcd.clear();
delay(2000);
return; 
}

if(menit > 59){
menit = 0;
}

if(menit < 0){
menit = 59;
}  

setmenit();
}


void setdetik(){

  lcd.setCursor(0,0);
  lcd.print("Detik: ");
  lcd.print(detik);
  lcd.print("   ");

btsetx = digitalRead(btset);
btupx = digitalRead(btup);
btdownx = digitalRead(btdown);
btokx = digitalRead(btok);

if(btupx == 0){
delay(200);
detik++;  
}

if(btdownx == 0){
delay(200);
detik--;  
}

if(btokx == 0){
lcd.clear();
delay(2000);
t.hour = jam;
t.min = menit;
t.sec = detik;
rtc.setTime(jam,menit,detik);     // Set the time to 12:00:00 (24hr format)
return; 
}

if(detik > 59){
detik = 0;
}

if(detik < 0){
detik = 59;
}  

setdetik();




e. VIDEO HASILNYA